Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def
- bs1
- (A, t, offset
- =
- 0
- ):
- if
- len
- (A)
- ==
- 0
- :
- return
- -
- 1
- mid
- =
- len
- (A)
- //
- 2
- if
- A[mid]
- ==
- t:
- return
- mid
- +
- offset
- if
- A[mid]
- >
- t:
- return
- bs1(A[:mid], t, offset)
- return
- bs1(
- A[(mid
- +
- 1
- ):], t,
- offset
- +
- mid
- +
- 1
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement