Start
Search
Item
Set index to
1
Set found to
false
While not
found and
not end of
array
If item =
search
Found =
true
If
true
Item
output
found
Item not
found
Location =
index
No Yes
Yes
YesNo
No
Start
Input item
searching
for
Set found to false
Set bottom to 0
Set top to (MAX -1)
elements
While
bottom <=
top and not
found
Middle = (bottom +
top)/2
If list at
middle =
item
Found = true
If list at
middle <
item
Location = middle
Bottom = middle + 1
Top = middle - 1
If found =
true
Output
item was
not found
Output
location
item found
Stop
Yes
No
Yes
Yes
Yes
No
Yes
No

Search flowchart

  • 2.
    Start Search Item Set index to 1 Setfound to false While not found and not end of array If item = search Found = true If true Item output found Item not found Location = index No Yes Yes YesNo No
  • 6.
    Start Input item searching for Set foundto false Set bottom to 0 Set top to (MAX -1) elements While bottom <= top and not found Middle = (bottom + top)/2 If list at middle = item Found = true If list at middle < item Location = middle Bottom = middle + 1 Top = middle - 1 If found = true Output item was not found Output location item found Stop Yes No Yes Yes Yes No Yes No

Editor's Notes

  • #3 Good layout &amp; easy to follow.No stop function!
  • #7 Start1Input item searching for 1Set found to falseSet bottom to 0Set top to max-1Cut the top half of the elements