1. Engineering
  2. Computer Science
  3. 2040 1123b me eclasssrvualberta ca algorithm flipflopsortal nlength of a...

Question: 2040 1123b me eclasssrvualberta ca algorithm flipflopsortal nlength of a...

Question details



20:40 1123B ME eclass.srv.ualberta ca Algorithm flipFlopSort(al) nlength of a if n 2 then if afl] > a[2] then swap(a], af2) else FlipFlopSort(first [2n/3] entries of al) FlipFlopSort (last [2n/3] entries of al) FlipFlopSort(first [2n/3] entries of a|) Your implementation of flipFlopSort(...) should be put in a file flipflop.cpp. Also include code to read an array with up to 200 different 32-bit unsigned integers and to print the sorted array to the terminal. That is, it should read a value n on the first line followed by n space-separated integers ai,... , an appearing on the second line. We guarantee 1 n 200 and 0 ai 232 for each 1 i < n. Your solution should sort these integers in place using your implementation of flipFlopSort(...) and then print a single line with these n integers in sorted order, with one space between values. See one sample input and output below: Input 1 Output 1 0 22 2 9 18 2 0 18 2 9 2
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution