retagged by
1,224 views
3 votes
3 votes
An array A is of length n has log( n) distinct numbers.

What is the time complexity of sorting A by best comparison based algorithm ?
retagged by

1 Answer

0 votes
0 votes
We will use binary search tree kind of data structure (Heap Sort) to implement the operation of sorting..

Time complexity of Heap Sort for n items is O(n log n).

The time complexity for log (n) distinct elements will be O(n loglog n) ...

 

I am new to this platform so please correct me if am wrong..

Related questions

20.9k
views
2 answers
8 votes
radha gogia asked Jul 19, 2015
20,903 views
(A) Insertion Sort with time complexity O(kn)(B) Heap Sort with time complexity O(nLogk)(C) Quick Sort with time complexity O(kLogk)(D) Merge Sort with time complexity O(kLogk) what is the approach of doing this question ?
511
views
1 answers
0 votes
dhruba asked Jun 5, 2023
511 views
Consider performing QuickSort on an array of n distinct elements. What is the probability that no comparisons will be made between the smallest and largest element?a. 1/nb. 1/(n-1)c. 2/nd. 2/(n-1)Answer: d. 2/(n-1)