In: Computer Science
Question 3. Find a solution to the instance π = 2 3 1 4 5 7 6 of the Pancake Flipping problem using a greedy approach (15 points). Describe your algorithm using pseudocode. (10 points)
the pancake sorting pseudo code is in the second image and the given problem is solved using the same in the first image.
in pancake sorting we find the max element in a given array and bring it to top using 3 flips.
this process is then repeated for the remaining elements till the whole array is sorted.
this is similar to how selection sort works except we use flips to bring a element to top instead of directly exchanging positions.