0% found this document useful (0 votes)
6 views1 page

Binary Search Algorithm Steps Guide

Uploaded by

rulanrossouw
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Binary Search Algorithm Steps Guide

Uploaded by

rulanrossouw
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

KS4 – Algorithms Homework

Lesson 8 – Comparing searching algorithms

Homework
Task . Binary search algorithm
The steps for performing a binary search are written out below but they have
been mixed up. Some of the instructions are also incomplete.

Number the steps from 1-8 so that the instructions are in the correct sequence
and fill in the missing information.

Step Instruction
number

7 Repeat steps __3-6____ until you find the item you are searching
for or there are no more items to check (the range is empty).

4 If the midpoint item is equal to the search item, then


__finish____

2 Maintain a range of items where the search item might be


found. Initially, set the range to be the __whole list____

3 Find the item in the middle of the range (the midpoint item).

5 Otherwise, if the midpoint item is less than than the search


item, change the range to focus on the items after the
midpoint.

1 Take an ordered list of data and an item that is being searched


for (the search item).

6 Otherwise, if the midpoint item is greater than than the search


item, change the range to focus on the items before the
midpoint.

4 Compare the midpoint item to the ____desired item__

You might also like