guptaarth87 / binarysearch Goto Github PK
View Code? Open in Web Editor NEWThis project forked from neddoz/binarysearch
First, you are to create a BinarySearch class, that inherits from the list class the following: the __init__() takes two integers as parameters, a and b. a is the length of the list to be created and b is the step or difference between consecutive values. It should also initialize an instance variablelength`, that returns the number of elements in the array Once you are done, create another method called search, it will take just one argument which is the value you are to find. The search function should return a dictionary object, which contains count, the number of times you function iterated to find the index of the number in question index, the index of the number in question The search method should implement the binary search algorithm, each time you iterate, you should increase the count, to test how efficient your implementation is.