Binary search (Edexcel GCSE Computer Science): Flashcards

📚Flashcards
Binary search
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

14 cards from this deck

Show

Type of search algorithm for sorted lists

Binary search

Critical requirement for binary search to work

List must be sorted

Strategy used by binary search

Divide-and-conquer

First step in binary search process

Select the median (middle item)

Action if search item < median

Discard median and everything to its right

Action if search item > median

Discard median and everything to its left

What happens when search item = median

Item is found

Median position with odd number of items

Middle item

Median position with even number of items

Round down to lower middle position

Formula for median position

length+12\frac{\text{length} + 1}{2} using integer division

Max checks for 11 items in binary search

3 checks

Max checks for 1000 items in binary search

10 checks

What each step eliminates in binary search

Roughly half of remaining possibilities

When does binary search end

When item found or no more items left to check

Join 100,000+ GCSE students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.