Unsorted Lists vs Linear and Binary Search
sorting a list has a O(log(N)*N) complexity at best.
Linear search has O(N) complexity.
So if you have to search more than once, you begin to gain time after some searches.
If objects are hashable (ex: integers) a nice alternative (when searching more than once only) to sorting+bisection search is to put them in a set. Then complexity is down to O(1) because of hashing, but still O(N) to create it, and the hashing adds to the toll.
If you need only to search once, linear search is the best choice.
Hey guys so I've been studying for an upcoming test and I came across this question:

If you had an unsorted list of one million unique items, and knew that you would only search it once for a value, which of the following algorithms would be the fastest?

Use linear search on the unsorted list
Use insertion sort to sort the list and then binary search on the sorted list


Wouldn't the second choice be the fastest? Sorting the list and then looking for the value than only using linear search?