Question: In Lecture 6, we sketched the radiz sort algorithm for sorting an array of n d-digit integers, with each digit in base k, in linear

In Lecture 6, we sketched the radiz sort algorithm for sorting an array of n d-digit integers, with each digit in base k, in linear time e(d(n+k)). The basic algorithm is as follows for j-1..d do sort the input stably by each element's jth least-significant digit The sort we used in each pass through the loop was Counting Sort, but any stable sort will work (albeit perhaps with different overall complexity). We tried this algorithm and saw that it worked on an example. Your job is to prove inductively that this algorithm works in general. The class notes suggest proving the following loop invariant: after j passes through the loop, the input is sorted according to the integers formed by each element's j least-significant digits. 18. State and prove a suitable base case for the proof. 19. Now state and prove an inductive case for the proof. You may assume that the per-digit sort used in each iteration is (1) correct and (2) stable. 20. Why does the invariant imply that the radix sort as a whole is correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
