Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

In many Olympic competitions such as high jump, athletes wait in a line to show their skills. Let us emulate this line. Your simulation will simulate a 20 minutes interval. Each high jump may require several attempts, so it takes between 1 and 3 minutes to complete. New competitors arrive over time, with some randomness. In your simulation, the number of new competitors that arrive on each time step will vary between 0 and 1. To execute the simulation, at each moment of time, perform the following steps: Generate new competitors and add them to the queue. First, generate a random number (using Math.random()) between 0 and 1 to see how many competitors to add. If one competitor was selected, generate a random num- ber between 1 and 3 for each competitor to determine how many minutes this competitor will take. Enqueue this number. For the competitor at the head of the queue { the one who is jumping right now { decrement the number of minutes by 1. If the value becomes 0, this indicates that the competitor nished jumping. In this case, remove this competitor from the queue (if the queue was empty, it remains empty). We are interested in two important values: the average length of the queue of competitors, and the maximum length of the queue. Your program should compute these values. Repeat simulations 100 times and compute the average and maximum over all these simulations. Write the code of the main part of the program so that the code only uses the operations enqueue, dequeue, size, and isEmpty. Then, show that your program works with both types of queue implementation { as a linked list and as an array.

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

Suppose you are a manager in the it department for the

Suppose you are a manager in the IT department for the government of a corrupt dictator, who has a collection of computers that need to be connected together to create a communication network for his spies. You are given ...

Consider the market for small business loans in the context

Consider the market for small business loans. In the context of this market. How adverse selection impact lenders. How does adverse selection impact borrowers? In the context of this market provide 2 things that a lender ...

Question discuss the principle of least privilege in at

Question: Discuss the principle of least privilege in at least 250 words. Explain how this principle impacts data security. The response must be typed, single spaced, must be in times new roman font (size 12) and must fo ...

What service is defined as it services for example in a gym

What service is defined as IT services? For example, in a gym, is members called IT services? What else? could you give me another example?

With respect to the needham-schroeder 0v0ap authentication

With respect to the Needham-Schroeder (0V0AP) authentication protocol, assume that a client (point A in the 0V0AP description) is holding the wrong key Describe in PRECISE terms (in terms of the contents of the packets t ...

A monochromatic source emitting photons at 250 nm shines

A monochromatic source emitting photons at 250 nm shines with equal intensity on a zinc electrode (threshold n =1.04 x1015 Hz) and a sodium electrode (threshold n = 5.51 x1014 Hz). Which of the following statements is tr ...

The big bad wolf loves eating little pigs for breakfast

The big bad wolf loves eating little pigs for breakfast, lunch, dinner, supper, midnight snacks and he does know all about second breakfast. He tends to consume a lot of little pigs in a week. (He is probably not Jewish) ...

The local police department must write an average of 5

The local police department must write an average of 5 traffic tickets each day to keep department revenues at budgeted levels. Suppose the number of tickets written per day follows a Poisson distribution with a mean of ...

Suppose a coworker approaches you and asks what an ethical

Suppose a coworker approaches you and asks what an ethical hacker does. She does not understand the role that an ethical hacker plays in the security industry and assumes that such a hacker intentionally causes damage. E ...

How is the study of how firms decisions about prices and

How is the study of how firms' decisions about prices and quantities depend on the market conditions they face, the field of industrial organization, and the cost of production.

  • 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