• edited by
1,899 views
1 1 vote

Q : What is the running time of heap sort for presorted input of size n?

  1. O(n)                  B) O(n^2)              C) O(nlogn)               D) O(logn)

In the question they didn’t mention if its a max or min heap and also they didn’t mention if the “presorted” input is in ascending or descending order.

For example, if we take max heap, if the order of input is decreasing order, the time complexity would be O(n) and for decresing order it would be O(nlogn).

Is the question incomplete or am i missing some concepts?

Please log in or register to answer this question.

Position:
Show:

Related questions

1 1 vote
1 1 answer
1.6k
1.6k views
LavTheRawkstar asked Sep 9, 2018
1,574 views
Sort The Following Sequence of input using Heap sort.{ 10 , 2 , 1 , 5, 3 ,8 ,11,24 ,7 }Please show the output at every pass because i am getting confused.
0 0 votes
1 1 answer
842
842 views
Balaji Jegan asked Jun 18, 2018
842 views
Would it be possible to implement a variant of heapsort based on a perfectly balanced ternary structure in which the children of node $i$ are at positions $3i - 1, 3i$, a...
1 1 vote
3 3 answers
2.0k
2.0k views
rahul sharma 5 asked Nov 27, 2017
2,012 views
Merging k sorted lists of size n/k into one sorted list of n-elements using heap sort will take how much time ?My doubtFirst approach:- here it is mentioned heap sort so,...
1 1 vote
1 1 answer
1.2k
1.2k views
reena_kandari asked Jul 30, 2016
1,232 views
The number of elements that can be sorted in time using heap sort ?