Question 1 consider we implement a priority queue as a heap

Assignment Help Data Structure & Algorithms
Reference no: EM13350995

Question 1: Consider we implement a priority queue as a heap. Suppose the queue has thousands of elements. Consider 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 recently 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) Evaluate the average complexity of an enqueue operation.

b) Determine the average complexity of the dequeue (remove) operation.

Question 2: Let's analyze the Heap dequeue/enqueue operations with different assumptions. Suppose 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 consider that any new element to be enqueued is equally likely to be placed anywhere into that sequence. You can suppose that the heap contains n = 2k-1 elements for simplicity.

a) Evaluate the average complexity of an enqueue operation.

b) Determine the average complexity of the dequeue (remove) operation.

Question 3: We considered building a balanced (or full) BST from a sorted array. Suppose 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 for the total number of comparisons to insert all the elements into the BST.

Reference no: EM13350995

Questions Cloud

American medical technology clearly leads the world the : american medical technology clearly leads the world. the very best lifesaving technology is developed here and our
Question 1 polymer diffusion the figure below indicates the : question 1 polymer diffusion the figure below indicates the result of a particle tracking experiment where lateral
Looking to the future there are many challenges facing : looking to the future there are many challenges facing american health care providers. what do you consider to be
A common theme observed in modern organizations today is : a common theme observed in modern organizations today is the poor alignment of business strategy and hrm strategy. find
Question 1 consider we implement a priority queue as a heap : question 1 consider we implement a priority queue as a heap. suppose the queue has thousands of elements. consider
Q1 group produce a4 size poster advertising and : q1 group produce a4 size poster advertising and highlighting the essentials hrm approach to recruitment and selection
A beauty salon hires three hairdressers each customers get : a beauty salon hires three hairdressers. each customers get their hair washed in one area of the saloon before being
Q1amanda white has started a domestic cleaning business : q1amanda white has started a domestic cleaning business spotless view cleaning svc. she started the business on 1st may
Do you realise any value in rob improving his skills at : do you realise any value in rob improving his skills at conducting performance discussions? what benefits will he or

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd