package Sorts; import static Sorts.SortUtils.*; /** * Comb Sort algorithm implementation *
* Best-case performance O(n * log(n)) * Worst-case performance O(n ^ 2) * Worst-case space complexity O(1) *
* Comb sort improves on bubble sort.
*
* @author Sandeep Roy (https://github.com/sandeeproy99)
* @author Podshivalov Nikita (https://github.com/nikitap492)
* @see BubbleSort
* @see SortAlgorithm
*/
class CombSort implements SortAlgorithm {
// To find gap between elements
private int nextGap(int gap) {
// Shrink gap by Shrink factor
gap = (gap * 10) / 13;
return (gap < 1) ? 1 : gap;
}
/**
* Function to sort arr[] using Comb
*
* @param arr - an array should be sorted
* @return sorted array
*/
@Override
public