• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Algorithms | Sorting | Question 5

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?

(A)

Insertion Sort with time complexity O(kn)

(B)

Heap Sort with time complexity O(nLogk)

(C)

Quick Sort with time complexity O(kLogk)

(D)

Merge Sort with time complexity O(kLogk)

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments