Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~195 People Reached
Favorite Forums
Favorite Tags
Member Avatar for JesW9

def binary_search(data,key): found=False low=0 high=len(data)-1 while(not found and low<=high): guess=(high+low)//2 if (key==data[guess]): found=True else: if (key<data[guess]): high=guess-1 else: low=guess+1 if(not found): guess=-1 return guess def test(): seq = [] for i in range(1,1001): seq.append(i) for j in range(1,100): is_pass = (binary_search(seq,j)==j-1) assert is_pass == True, "fail the test when key …

Member Avatar for Lardmeister
0
195