29 lines
425 B
Plaintext
29 lines
425 B
Plaintext
a : 1 : 2 : 27 : 44 : 46 : 57 : 77 : 154 : 212
|
|
|
|
binary_search param item index size
|
|
index saveindex
|
|
index L
|
|
(index + size - 1) H
|
|
if L <= H
|
|
((L + H) shr 1) M
|
|
if base.M > item
|
|
- 1 M H
|
|
else
|
|
if base.M < item
|
|
+ 1 M L
|
|
else
|
|
- saveindex M
|
|
return M
|
|
endif
|
|
endif
|
|
goif
|
|
endif
|
|
return -1
|
|
|
|
start
|
|
|
|
call binary_search 77 @a #a
|
|
result R
|
|
|
|
"'result = ' R" []
|