Q:

Given an unsorted array

0

Given an unsorted array

The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?


  1. Insertion Sort with time complexity O(kn)
  2. Quick Sort with time complexity O(kLogk)
  3. Heap Sort with time complexity O(nLogk)
  4. Merge Sort with time complexity O(nLogk)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Correct Answer:

Heap Sort with time complexity O(nLogk)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

ADA Algorithm MCQ Quiz (Multiple Choice Questions And Answers)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is the best time complexity of bubble sort?... >>
<< which of the following is ALWAYS TRUE?...