Which is faster?
Write two functions; a binary search and a linear search. These functions should be passed a list of sorted integers and then return the position of the integer it was searching for and how long it took to do it.
You should write a program that runs these functions 100's of times and calculates the average search time.
You may not use the internet to find code for binary or linear searches - these must be coded yourself.
Use the attached csv file to populate your list or write another function that generates it automatically. Remember the list should already be sorted - not in a random order.
You should write a program that runs these functions 100's of times and calculates the average search time.
You may not use the internet to find code for binary or linear searches - these must be coded yourself.
Use the attached csv file to populate your list or write another function that generates it automatically. Remember the list should already be sorted - not in a random order.
numbers.csv | |
File Size: | 0 kb |
File Type: | csv |