Inactive Tutor answered 03/15/21
linear search is O(n) : one for loop passes through the array
binary search is O( log N) : Half the array gets searched
bubble sort is O(n^2) : for each pass of the array, performs another pass
Jule J.
asked 03/15/21What is the running time for:
-Linear Search
-Binary search
-bubble sort
For each algorithm above, why do they take the time that they do?
Inactive Tutor answered 03/15/21
linear search is O(n) : one for loop passes through the array
binary search is O( log N) : Half the array gets searched
bubble sort is O(n^2) : for each pass of the array, performs another pass
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.