Ordinary case
Search for a value near the middle.
Linear search checks items from the beginning. Binary search repeatedly halves a sorted search range. Bubble sort compares neighbouring values and swaps those in the wrong order. These demonstrations show the actions rather than simply giving the answer.
All numbers are teaching examples. Binary search only works correctly on the sorted list supplied here.
Select Step to begin.
Comparisons: 0
The original list is 7, 3, 9, 1, 5, 8. Compare neighbours and swap when needed.
Interactive display:
Search for a value near the middle.
Search for the first and last values.
Search for a number that is not in the list.
No login required. Your answers and button presses are not transmitted to TutorSyntax.
Independent TutorSyntax educational material, inspired by the wider UK computing curriculum. Not an official examination-board or government qualification resource.