February 7, 2024
February 7, 2024
February 7, 2024
###### ISRO CS-2023
February 7, 2024
 Question 6
Worst case time complexity of heap sort for n elements
 A O(nlogn) B O(logn) C O(n2) D O(n)
Question 6 Explanation:
Heap Sort has a time complexity of O(n log n) in the worst case because it builds a max-heap or min-heap (depending on whether it’s sorting in ascending or descending order) and performs n iterations (heapify) for n elements.
Each heapify operation takes O(log n) time in the worst case.
Correct Answer: A
Question 6 Explanation:
Heap Sort has a time complexity of O(n log n) in the worst case because it builds a max-heap or min-heap (depending on whether it’s sorting in ascending or descending order) and performs n iterations (heapify) for n elements.
Each heapify operation takes O(log n) time in the worst case.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!