Explanation
- **Cycle Sort** is a non-comparative sorting algorithm that places elements at their correct positions by cycling them through the array. It is efficient for sorting arrays where the elements are distinct.
-
-
Steps:
- For each element in the array, find its correct position by rotating the cycle.
- Swap the element to its correct position.
- Repeat until all elements are sorted.
-
Time Complexity:
- Best, Average, Worst Case: O(n^2).