Analyzing shell sort algorithm (big O)
问题 This is the shell sort algorithm. void shellSort(int array[], int n){ for (int gap = n/2; gap > 0; gap /= 2){ for (int i = gap; i < n; i += 1) { int temp = array[i]; int j; for (j = i; j >= gap && array[j - gap] > temp; j -= gap){ array[j] = array[j - gap]; } array[j] = temp; } } } I'm certain that the outer loop of this algorithm runs logn times but I'm not sure with the middle loop and the innermost loop. This site https://stackabuse.com/shell-sort-in-java/ said that the middle loop runs n