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

  Function to swap all the left-right subtrees of binary tree

Write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. write a method singleParent, that returns the number of nodes in a binary tree that have only one child.

  Using quicksort with median-of-three

Show the steps in details of sorting {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5} using quicksort with median-of-three partitioning and a cutoff 3 (if the elements are less than 3, using insertion sort).

  Conversion with unnormalized relation

Nazca Cinemas is a tiny movie theater that would like you to create a movie scheduling database system for them. The theater has 4-screens. Each screens has its own unique ID

  Data speed effect on fundamental business decisions

Can the speed in which data is transmitted have an adverse effect on fundamental business decisions? Yes, speed that is traveling at big rates of speed can have an affect on fundamental business decisions.

  Quicksort will result in quadratic behavior

Describe a case where quicksort will result in quadratic behavior.

  Creating the table showing decimal value

Assume if the last digit of a 2's complement binary number is 0, then number is even. If the last two digits of a 2's complement binary number are 00

  Show the final shortest-path tree

draw a table showing the intermediate distance values of all vertices at each iteration of the algorithm; (ii) show the final shortest-path tree.

  Write a method that uses the bst to output

Write a method to count the number of items in the BST (Note that you should do this by traversing the BST and not in any other way). The method returns an integer.

  Will simulate the step by step execution of lru algorithm

The algorithms will be simulated based on a reference string (a sequence of pages that are to be accessed) that will be either read from the keyboard or randomly generated.

  Create a crow''s foot erd using a specialization hierarchy

the following business scenario, create a Crow's Foot ERD using a specialization hierarchy if appropriate. Tiny Hospital keeps information on patients and hospital rooms.

  System analyst

A huge, well regarded supplier of key raw materials to your corporation's production process requires a year-end summary report of totals purchased from it.

  Hierarchy chart and design the logic

Draw the hierarchy chart and design the logic for a program that calculates the projected cost of an automobile trip. Assume that the user's car travels 20 miles per gallon of gas. Design a program that prompts the user for a number of miles drive..

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