Change the bubble sort algorithm (Program 12-5) as follows: Use twodirectional bubbling in each pass. In the first bubbling, the smallest element is bubbled up; in the second bubbling, the largest element is bubbled down. This sort is known as the shaker sort.
Using the techniques discussed in “Sorts and ADTs” at the end of Section 12.1, create an ADT using the selection sort (Program 12-1). Then write a test driver to test it once with an array of integers and once with an array of floating-point numbers.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here