In the Flipping Pancakes box, the original algorithm given requires at most 2n − 3 flips in the worst case. The claim is made that the new algorithm, which requires at most (5n + 5)/3 flips, is a better algorithm. How many pancakes do you need to have before the second algorithm is indeed faster? Perform a selection sort on the list 7, 4, 2, 9, 6. Show the list after each exchange that has an effect on the list ordering. The selection sort algorithm could be modified to stop when the unsorted section of the list contains only one number because one number must be in the correct position. Show that this modification would have no effect on the number of comparisons required to sort an n-element lis
In the Flipping Pancakes box, the original
The selection sort algorithm could be modified to stop when the unsorted section of the list contains only one number because one number must be in the correct position. Show that this modification would have no effect on the number of comparisons required to sort an n-element list.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images