Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Given an unsorted array where each element is at most k distance from its position in a sorted array. Which sorting algorithm can be easily modified for this and what is its time complexity?





Solution

Solution: A k-sorted array can be efficiently sorted using a min-heap of size k, yielding O(n log k) time.
Answer: (B) Heap Sort with O(n log k)


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...