Considering that to prove a recursive algorithm we should refer to mathematical induction. Given the following algorithm (which sort an Array of size r) I found that base cases are for array size of 0 and 1 because an empty or 1-element array is already sorted. How can I prove mathematically that the algorithm behaviour holds for bigger sizes of the array?
1: MYSTERY(A,l,r)
2: range := r − l + 1
3: subrange := d(2 · range/3) // d() I assumed d() as the ceiling function
4: if range = 2 and A[l] > A[r] then
5: swap A[l] ↔ A[r]
6: else if range ≥ 3 then
7: MYSTERY(A,l,l + subrange − 1)
8: MYSTERY(A,r − (subrange − 1),r)
9: MYSTERY(A,l,l + subrange − 1)
10: end if
11: end