\ Binary search var a{10},i; procedure search(key); var low,high,mid,res; begin low:=0; high:=9; res:=-1; while low[high do begin mid:=(low+high)/2; if a{mid}key then high:=mid-1 else begin res:=mid; high:=-1 end end; out:=res \ print subscript of slot end; begin \ Load array i:=0; while i<10 do begin a{i}:=10*i; i:=i+1 end; \ Test with fixed set of cases i:=-5; while i<100 do begin call search(i); i:=i+5 end; i:=in; \ Test with user-provided cases while i#(-999999) do begin call search(i); i:=in end end.