Given an unsorted array. The array has this property that every element in the array is at most k distance from its position in a sorted array where k is a positive integer smaller than the size of an array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?
Insertion Sort with time complexity O(kn)
Heap Sort with time complexity O(nLogk)
Quick Sort with time complexity O(kLogk)
Merge Sort with time complexity O(kLogk)
This question is part of this quiz :
Top MCQs on Complexity Analysis of Algorithms with Answers,Top MCQs on QuickSort Algorithm with Answers,Top MCQs on HeapSort Algorithm with Answers