Question 1
Alice has some cards with numbers written on them. She arranges the cards in decreasing order, and lays them out face down in sequence on a table. she challenges Bob to pick out the card containging a given number by turning over as few cards as possible. Write a function to help Bob locate the card.
cards= [13, 11, 10, 7, 4, 3,8, 9, 24]
query= 24
output = 4
In [61]:
Linear search
Q 2
how many time the sorted list is rotated:
Linear search