← Back to Hub

🔘 Binary Lands

Sort 0s and 1s Using Two-Pointer Partition

Zeros
0
Ones
0
Swaps
0
Status
Sorting

Goal: All 0s on left, all 1s on right. Use two pointers!

Left Pointer: 0
Right Pointer: 0

Current Action

arr[left]=? arr[right]=?

📚 0-1 Sort (Dutch National Flag Variant)

Partition an array of 0s and 1s in linear time:

📋 Sort History