Aspire Faculty ID #12673 · Topic: JECA MCA 2024 · Just now
JECA MCA 2024

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)

Previous 10 Questions — JECA MCA 2024

Nearest first

Next 10 Questions — JECA MCA 2024

Ascending by ID
Ask Your Question or Put Your Review.

loading...