Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

problem 1: Suppose we implement a priority queue as a heap. Assume the queue has thousands of elements. Suppose further that we have four different priorities (1-4, highest to lowest). The heap typically has 5% of priority 1 elements, 10% priority 2 elements, 15% priority 3 elements, and 70% of priority 4 elements. The probability of the newly arriving element at priority i, P(i)  is  P(1) = 0.05, P(2) = 0.10, P(3) = 0.15 and P(4) = 0.7.

a) Find the average complexity of an enqueue operation.
b) Find the average complexity of the dequeue (remove) operation.

problem 2: Let's analyze the Heap enqueue/dequeue operations with different assumptions. Imagine that the elements already in the queue were put into a sequence with the head element at the front at the lowest priority elements toward the end. Then assume that any new element to be enqueued is equally likely to be placed anywhere into that sequence. You can assume that the heap contains n = 2k-1 elements for simplicity.

a) Find the average complexity of an enqueue operation.
b) Find the average complexity of the dequeue (remove) operation.

problem 3
: We considered building a balanced (or full) BST from a sorted array. Assume that the array has n = 2k-1 elements in sorted order. We will insert the array middle element first (as the root), then insert the middle element of the left half, then the middle element of the right half, and so on recursively. Since the array has n elements, the actual work at each level is the insert into the BST. Define the model (using a summation ) for the total number of comparisons to insert all the elements into the BST.

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

Question suppose you wanted to implement a new routing

Question : Suppose you wanted to implement a new routing protocol in the SDN control plane. At which layer would you implement that protocol? Explain. The response must be typed, single spaced, must be in times new roman ...

Lnguage isnbspcgenerate a sparse vector class with

Language is  C++ Generate a sparse vector class with * operator, such as  Vector Vector::operator * (Vector& param) A multiplication (*) operators returns element-wise multiplication of two vectors in another vector. Giv ...

1 the lab manual instructs you to heat camphor at position

1.) The lab manual instructs you to heat camphor at position 2 on the hot plate, which is a moderately low setting. What would be a problem of heating the camphor too quickly? 2.) A mixture of ammonium chloride, sand, an ...

Should you perform a log transformation on a categorical

Should you perform a log transformation on a categorical (nominal) variable, or can you only do that for continuous variables?

Describe how to discover cookies on web browsers what is a

Describe how to discover cookies on web browsers. What is a reverse DNS lookup and can it be used when attacking the network.

What is a security policy and why is it so critical to the

What is a security policy and why is it so critical to the success of an organization's information security program? Select an Issue Specific Security Policy and describe why an organization should have this issue cover ...

Question responsive frameworks and libraries provide

Question : Responsive frameworks and libraries provide convenience when creating a modern website. Discuss at least three design options, such as hiding content or layout changes, that would be beneficial for a responsiv ...

Question discuss the advantages and disadvantages of

Question: Discuss the advantages and disadvantages of Incident Response testing. When is each type of testing appropriate? Are there situations that preclude the use of a particular type of testing? Requirement: I recomm ...

Explain how amazon and walmart companies use information

Explain how Amazon and Walmart companies use Information and Communication Technologies (ICT) in their competitive strategies. Highlight the differences in their use of ICT.

Question a suppose you do shading calculations in the

Question : a) Suppose you do shading calculations in the vertex shader. What happens to the vertex colors when they go from the vertex shader to the fragmant shader? b) Suppose instead you want to do the shading calculat ...

  • 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