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

  Process of insertion into a heap-implemented priority queue

Explain the process of insertion into a heap-implemented priority queue, and informally explain its complexity and the process of removal from a heap-implemented priority queue, and informally explain its complexity.

  List of common data structures

Make a list of some of the common data structures provided by C#. You should have a minimum of 4 different data types.

  Create algorithm to calculate union of two input sets-array

Create algorithm to calculate union of two input sets given as arrays, both of size O(n). The output must be array of distinct elements that form union of the sets.

  Creating algorithm broken into sequence of words

Katt wishes you to create an algorithm that, given a string X, determines efficiently how many ways X can be broken up into sequence of words.

  Creating an exception class and applet file

Create an applet document that prompts the user for an ID number and an age. Construct an Exception class and throw an Exception of that class if the ID is not in the range of valid ID numbers.

  Explain binary tree by induction

Binary tree is full if all of its vertices have either zero or two children. Let Bn denote number of full binary trees with n vertices. Illustrate by induction (substitution) that Bn is 2 (n) .

  Creating code for a class called arrayqsn

Create all the code for a class called ArrayQsn. This class will contain 2-techniques. The first technique runningSumMean accepts an array of ints as a parameter, and will return the mean of the values as a double.

  Explain solution to recurrence-appealing to recursion tree

Solve the following recurrence relations by the method of your choiceT(n) = 1 for n = 4 and T(n) =pnT(pn) + n for n > 4. Argue that the solution to the recurrence T(n) = T(n=3) + T(2n=3) + cn is (n lg n) by appealing to the recursion tree.

  Creating an access database

PLUS is a corporation that makes all types of visual aids for judicial proceedings. Customers are usually private law firms, although the District Attorney's office has occasionally contracted for its services.

  Find the checksum field in a single parity bit scheme

Assume that the information content of a packet is the bit pattern 1111000010100101 and an even parity is being used

  Algorithm-flow chart for people having computer experience

Write an algorithm and design a flow chart to determine all people who have computer experience.

  Creating a home inventory database

Construct one query of your selection. Remember a query answers a question. As an example, list all household electronics that are greater in value than $200.

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