0

Are closely related sorting algorithms Radix Sort and Bucket Sort Adaptive?

I know that a sorting algorithm is said to be adaptive if data to be sorted is pre-sorted and the algorithm takes minimal time.

However I am unable to conclude whether Radix and Bucket sort algorithms are adaptive or not.

Wilfred Almeida
  • 133
  • 1
  • 10
  • I don't believe so. Theoretically they take the same amount of effort whether the input was sorted or not. – 500 - Internal Server Error Aug 21 '20 at 09:38
  • For a large array, much larger than cache, a significant part of the running time is random access writes. If the data is already sorted or nearly so, these random access writes become sequential, which will reduce the running time. Although the running time is reduced, I don't think this qualifies as being adaptive. – rcgldr Aug 23 '20 at 21:26

1 Answers1

1

A sorting algorithm falls into the adaptive sort family if, it takes advantage of existing order in its input.

For example, "Insertion sort" is an adaptive sorting algorithm, if input is already sorted then time complexity will be O(n).

In case of "Bucket sort(or Bin sort)" and "Radix sort", there's no advantage for input order. Time complexity doesn't vary based on input order. That's why they are not adaptive sorting algorithm.

Note: To understand whether a sorting algorithm falls into adaptive sort family, you've to think about implementation approach, by which it's possible to optimize time complexity based on input order. Adaptive sorting is usually performed by modifying existing sorting algorithms.

Hope, it helps!

Resources:

Adaptive Sort details from Wikipedia

Adaptive and Non-Adaptive Sorting Algorithm