Last Minute Notes
Github
Docs
Learn
Search
⌘
K
@sayanstwt
Lessons
Learn
/
Data Structures & Algorithms
/
Arrays & Strings
Cyclic Sort
6 min
Intermediate
7 steps
Put each number in its own index and find what is missing.
n
4
Range
0..4
Goal
O(n), O(1)
0
1
2
3
4
0
3
1
n + 1 possible values, n slots: exactly one is missing
current
done
skipped
In this lesson
Step 1 of 7
1
The problem
2
Homes
3
Full sort
4
Missing
5
Final scan
6
Duplicates
7
Recap