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

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 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