Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

CS 361, Introduction to Data Structures Final Exam Fall 2015

You are not to communicate with anyone else in any manner concerning this exam during the exam period. The ODU Honor code is in effect for the duration. You are to solve no more than 3 of the following problems in C++, using the STL library; each code should run stand-alone as a simulation.  You can develop the code in any environment but they should compile using Code blocks. Submit your solutions as a single zipped file via blackboard.

Q1. Imagine that there are processes that are being generated at random intervals, each process has an id (0001 to 9999) and in addition each process has a complexity score that is directly proportional to the product of its required memory and its expected run time. We can treat the complexity score (c >= 0)  as a random value with a mean of 5and a standard deviation of 1. As the processes are generated they are placed into a queue of length q (q is user input).  Processes are removed from the front of the queue after they have been in the front for c time steps. IF a process is generated and the queue if full then the overload is placed in a separate priority queue with the lowest c score given the highest priority. When room is made in the process queue, it is refilled from the priority queue. Generate a simulation of this process handler.

Time

Queue

New Processes P-id(c)

Priority Queue

1

<> 

P1(3) P2(1)

<> 

2

P3(4)

<> 

3

None

<> 

4

P5(1)

 

etc

22

P55(3), P56(1)

<> 

23

P57(2)

24

None

Etc

None

Q2. Imagine a 3-d chess board (8x8x8) with one knight on it. The knight is placed at location level 0, row 0 and column 1, (standard position), implement an algorithm that will allow the knight to move around the board randomly until 90% of possible locations have been visited. Knights usually move a total of three spaces in an "L" shape. This is still true, but they now can go up one (or down) over two and up two (or down) and over one. There are 512 locations in a 3-d chess board.

Q3. This is an experimental question, please implement the following code fragment in a fully functional C++ code. Given ints j, n, and T: where n is user input, the functions b is return type bool, and both p and q each return a time cost. You will use the value T to store the cumulative sum of those costs.

i. For(j=0; j

ii. {If b(j) {T=T+q(j);}

iii Else {

1. If(b(j+1){T=T+q(j-1);}

2. Else {T=T+p(j+3);}

3. }

iv. }

Where  b(i) takes i+3 seconds and (on average) the function b( ) returns true 50% of the time q(i) takes i+1 seconds and p(i) takes i+2 seconds

Create a graph showing best, average, and worst case T scores for your code in number 3 above for n = powers of 2 from 21 to 216. If there are any results you cannot provide be specific as to the reason. You can modify the best/worst by modifying how often b( ) returns true.

Q4. Using your mountain project source code as a starting point, you are to write a code that randomly chooses one of the triangles on the surface of your mountain, this will be the entrance to your cave. A line segment representing that tunnel beginning at the centroid of that surface travels a distance equal to the average of the three sides of that triangle in the direction normal to that surface INTO the mountain. You should store this segment as a vector beginning at the centroid in the form  v = xmi + ymj + zmk . These xm, ym, and zm values will be referenced many times. At this point what happens is determined by the following table.

Probability

Event

0.10

Continue straight for the same distance as before

0.70

Tunnel changes direction by generating a new random vector direction such that when

 v=ai  + bj + ck

-xm< a m

-ym< b m

-zm< c m

.10

The tunnel splits in two by generating two different vectors  in the same way as the change of direction table above

.10

Current tunnel  branch terminates

As the tunnel splits then there is an additional branch that must be explored. If at any time a branch of the tunnel intersects the surface of your mountain that branch should terminate (hint: consider the 2-d projection of your quads as seen from above).

Save your tunnel system as a set of line segments in a separate data file then plot them with your mountain. They should automatically appear as a different color.

5. Create a class gene that contains a sequence of 4 amino acids (represented by chars A, T, C, G) Generate agene linked list of length L (user input) of class, this is a protein. Generate a second linked list of length L/2< L2 < L. Search for a matching sequence of at least 4 genes (16 acids) that can be found in both proteins. If none exist state so. If they do exist display at what index they can be found in each protein.

6. The equation of an ellipse is show below:

2365_Figure.png

If a and b are random integers in the range [1, 10] accept an integer N (2 to 5) from the keyboard, create N random ellipses, create a data file that contains x, y data for them and then plot them using gnuplot. This is a 2-d problem.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91966497

Have any Question?


Related Questions in Computer Engineering

Question rivests distinguished point dp method is a

Question : Rivest's "distinguished point" (DP) method is a variable length hash chain where all chain end points have the same d-bit suffix. In the precomputation phase, a chain is computed until a value is output with t ...

Secret channels a company uses public internet to carry its

Secret Channels A company uses public Internet to carry its phone service. The voice data will be encrypted before sending to Internet. The encryption algorithm is as follows: For each four-digit decimal integer, (1) Add ...

Question summary on hypertext transfer protocol http

Question : Summary on Hypertext Transfer Protocol (HTTP) describing its major features, principles of operation and application in transferring traffic over the World Wide Web. The response must be typed, single spaced, ...

Find example that shows ideas can have big consequences in

Find example that shows ideas can have big consequences in the world. Describe the problem and how the idea helped to solve the problem. Include references

A humane society claims that less thannbsp33 of us

A humane society claims that less than 33?% of U.S. households own a dog. In a random sample of 409 U.S.? households, 155 say they own a dog. At alpha(α) = 0.04?, is there enough evidence to support the? society's claim? ...

Storing the integer 5 value in a binary file 00000000

Storing the integer 5 value in a binary file: 00000000 00000000 00000000 00000101, How do you write value5 to this formation 0000101? Storing the integer 5 value in a text file: 00110101, How do you write value5 to 00110 ...

Suppose a life insurance company sells a 230000 one-year

Suppose a life insurance company sells a $230,000 ?one-year term life insurance policy to a 20?-year-old female for ?$330. The probability that the female survives the year is 0.999642. Compute and interpret the expected ...

Need guidance on a c program that1 asks the user to input a

Need guidance on a C++ program that: 1. Asks the user to input a number of cents 2. Calculates and displays the number of quarters, dimes, nickels, and pennies that should be used to reach the value. EX: 67 cents would b ...

Here is a series of addresses in hexadecimal20w 3cr 10r 16w

Here is a series of addresses in hexadecimal: 20(w), 3C(r), 10(r), 16(w), 20(r), 04(w), 28(r), 6(r), 10(w), 17(w) Assume a LRU replacement algorithm. Draw each of the following caches as it would appear at the end of the ...

I am studying java for the first time and i am using a

I am studying java for the first time and I am using a program called Eclipse to build my programs. I am working with arrays and I am tasked with the following: Create a method that restores an image in which each pixel ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As