1. Consider the following two sort methods and the following two search methods.
ID: 3869331 • Letter: 1
Question
1.
Consider the following two sort methods and the following two search methods.
Give the "Big-Oh" time complexity for each method.
- merge sort time complexity: ( )
- sequential search time complexity: ( )
- selection sort time complexity: ( )
- binary search time complexity: ( )
2.
Place the methods described above in order of their "Big-Oh" time complexity, from slowest to fastest growth (i.e. from lowest to highest complexity). As a reminder, here are the methods again:
- merge sort
- sequential search
- selection sort
- binary search
SLOWEST: , , , FASTEST
thanks!
Explanation / Answer
1.
- merge sort time complexity: O(n log(n))
- sequential search time complexity: O(n)
- selection sort time complexity: O(n^2)
- binary search time complexity: O(log(n))
2.
- selection sort O(n^2) < merge sort O(n log(n)) < sequential search O(n) < binary search O(log(n))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.