Skip to content
Sortingadvanced

Pancake Sort

The only allowed operation is a prefix flip — reverse the first k elements, like flipping a stack of pancakes with a spatula. Each round flips the largest unsorted value to the front, then flips it down to its final place at the back.

Best
O(n)
Average
O(n²)
Worst
O(n²)
Space
O(1)
Stable
No