A number of different sized pancakes are stacked. A sorted pancake stack is defined as having the smallest pancake on top, the second smallest pancake under the smallest pancake, etc. The only tool provided is a spatula that will flip any top partition of the stack, including the entire stack. Note that there only ever exists one stack of pancakes, not multiple smaller, independent stacks.
Assume that an arbitrary stack of n pancakes is represented as a Python list of numbers, with each number representing the size of the pancake. When sorted, the smallest pancake (with the smallest number) will be at index 0 in the list, and the largest pancake will be at index n – 1. Write a Python function named pancakeSort that expects one argument, a possibly unsorted list of numbers representing pancakes. that uses the flipping technique described above to sort the list. rger pancakes may be on top of smaller pancakes and vice versa.
A number of different sized pancakes are stacked. A sorted pancake stack is defined as having...
1. A number of different sized pancakes are stacked. A sorted pancake stack is defined as having the smallest pancake on top, the second smallest pancake under the smallest pancake, etc. The only tool provided is a spatula that will flip any top partition of the stack, including the entire stack. Note that there only ever exists one stack of pancakes, not multiple smaller, independent stacks. Larger pancakes may be on top of smaller pancakes and vice versa. a) If...
help me answer the following questions please 1. Stack (LIFO) & its application 1. Stack overflow & underflow 2. Implementation: partially filled array & linked list 3. Applications: reverse string, backtracking Exercises: 1) Which of the following applications may use a stack? A. parentheses balancing program. B. Keeping track of local variables at run time. C. Syntax analyzer for a compiler. D. All of the above. 2) Consider the usual algorithm for determining whether a sequence of parentheses is balanced....