Tutorial by Examples

Pancake Sort is a the colloquial term for the mathematical problem of sorting a disordered stack of pancakes in order of size when a spatula can be inserted at any point in the stack and used to flip all pancakes above it. A pancake number is the minimum number of flips required for a given number o...
public class PancakeSort { private static void SortPancake(int[] input, int n) { for (var bottom = n - 1; bottom > 0; bottom--) { var index = bottom; var maxIndex = input[bottom]; int i; for (i = bottom - 1; i >= ...

Page 1 of 1