2.1 Searching Algorithms Computing OCR GCSE
2.1 Searching Algorithms Computing OCR GCSE
Take the middle value – lowest position + highest position DIV 2 (1+10=11 // 2 = 5)
16 > 9 so make a new list with all the numbers to the left
BINARY SEARCH –
SEARCHING FOR 9
Search the new list for 9
Take the middle value - lowest position + highest position DIV 2 (1+4=5 // 2 = 2)
Take the middle value - lowest position + highest position DIV 2 (3+4=7 // 2 = 3)
INDEX
Value 0 1 2 3 4 5 6 7 8 9
Number 2 6 9 12 16 18 20 23 45 99
ENDFOR ENDIF
ENDWHILE
OneNote - 2.1 L8 Searching
Algorithms
SEARCHING ALGORITHMS
Any questions?
EXTENSION
Task 1:
Go to the extension on your OneNote 2.1 Ext: L8 Searching
Algorithms