Suppose that you are given a stack of pancake radii r1,r2, . . . ,rn, arranged from top to bottom, where {r1,r2, . . . ,rn} = {1, 2, . . . , n} (but not necessarily in order). Write down a fully quantified logical expression that expresses the condition that . .
3.168 . . . the given pancakes are sorted.
3.169 . . . the given pancakes can be sorted with exactly one flip (see Figure 3.38).
3.170 . . . the given pancakes can be sorted with exactly two flips. (Hint: writing a program to verify that your indices aren’t off by one is a very good idea!)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here