1/15
Loading...
🚀Start Dutch National Flag
Sort an array of only 0s, 1s, and 2s in a single pass using three pointers: low, mid, and high.
Loading...
Sort an array of only 0s, 1s, and 2s in a single pass using three pointers: low, mid, and high.
The Dutch National Flag problem sorts an array of only 0s, 1s, and 2s (likened to red, white, blue) into 0 → 1 → 2 order in a single pass with no extra memory. It is a classic 3-way partitioning technique proposed by Dijkstra.