Find running time of heap sort input sorted-ascending order

Assignment Help Data Structure & Algorithms
Reference no: EM1386474

HEAPSORT( array A, int n)

1 BUILD-HEAP(A, n)
2 m n
3 while (m  2)
4 do SWAP(A[1],A[m])
5 m m- 1
6 HEAPIFY(A, 1,m)

Let the pseudo code of Heap Sort reply following questions (you need to justify your answers as well),

a. Determine the running time of Heap Sort if input is sorted in ascending order

b. Determine the running time of Heap Sort if input is sorted in descending order

c. What is best case input (format of input resulting in best case time) for Heap Sort.

 

Reference no: EM1386474

Questions Cloud

Antisense technique to prevent allergen gene : Genetically modified almonds to be come allergen-free. What is the step by step mechanism of how to use antisense technique to prevent allergen gene from being express?
What is the enhancement in temperature of bullet : A flight attendant pulls her 63-N flight bag a distance of 277-m along a level airport floor at a constant velocity. The force she exerts is 35N at an angle of 57° above the horizontal. Determine the work completed by the force of friction on flig..
How many cars would you expect to see in the system : How many cars would you expect to see in the system. A toll tunnel has decided to experiment with the use of a debit card for the collection of tolls. Initially, only one lane will be used
What torque is required to the motor : A 24.00 kg child is on a swing that hangs from 1.6-m long chains. What is her highest speed if she swings out to a 45° angle.
Find running time of heap sort input sorted-ascending order : Determine the running time of Heap Sort if input is sorted in ascending order. Determine the running time of Heap Sort if input is sorted in descending order.
Formulate a spreadsheet model that will give the profit : Formulate a spreadsheet model that will give the profit in part b for any of the two numbers. Use the Excel goal seek command to calculate the break-even point found in part a.
Question about molecular biology : Assume you infected an E. coli culture with a virulent bacteriophage. Most of the cells lysed, but a few survived - 1x10^-4. You wonder where the resistant bacteria came from.
Determine the amount by which the spring is stretched : A 9.10 kg board is wedged into a corner and held by a spring at a 50° angle, as the Illustrating shows. The spring has a spring constant of 196 N/m and is parallel to the floor.
Determine the mode shapes and frequencies of vibration : Determine the mode shapes and frequencies of vibration of the system of cars by Sweeping the rigid body mode

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Find fraction of time during which queue grows

Suppose now there are three users. Find the probability that at a given time, all three users are transmitting simultaneously. Find the fraction of time during which the queue grows.

  Find maximum possible amount of money by optimal strategy

Removes it from row permanently, and receives value of coin. Find out the maximum possible amount of money we can definitely win if we move first.

  Show state of memory after processes by best fit algorithm

Using the best fit algorithm, show the state of memory after processes of 212K, 417K, 112K and 350K (in request order) arrive.

  Greedy strategy for finding a shortest path

Think about the given greedy strategy for finding a shortest path from vertex start to vertex goal in a connected graph.

  Explain the three types of relationships

Provide an example of a one to one relationship and an example of a many-to-many relationship in a newspaper, magazine, book, or everyday situation you encounter.

  Question about unix commands

Assume you have a document called records.txt having the list of employee id and workers names. Every line contains a single employee id immediately followed by the employee name in the format Last name, First name.

  Create ef?cient algorithm to fnd redundancies

Fnd the redundancies m1, · · · , mn that are within the available budget and that maximize probability that system works correctly. Create an ef?cient algorithm.

  Data warehouse and operational databases

Every big organization has large documents or databases containing data used in operating the business. Does a data warehouse differ from these operational files or databases?

  Advanced systems analysis and design

Produce a system specification indicating functional and non-functional requirements - Generate suitable prioritised Use Cases for the system.

  Write algorithm to calculate the median using queries

Calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.

  Programming language problems

Many programming languages do not permit you to ask two or more questions in a single comparison by using a logical And Operator

  Explaining playout delay algorithm

Let the adaptive playout delay algorithm. Show through simple example that adjusting playout delay at beginning of each talk.

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