Back to algorithmsPodstawowy
Linear Search
The simplest way to search: we check the elements one by one, from the first, until we hit the target or run out of array. Works on any array โ sorted or not.
O(n)O(1)BOBRALEMOZGIINSTALOGIKOIJ
๐ Linear Search โ Games
Play both games to master the algorithm!
๐ก
Tip: Start with Game 1 โ the lockers show why we search in order and when you may say "not here". In Game 2 you run the code step by step yourself, exactly like tracing code on paper in a contest.