Arrange the following search and sort algorithms in ascending order of their worst-case complexities:
A. Merge sort
B. Linear search
C. Bubble sort
D. Binary search
Choose the correct answer from the options given below:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: A. D, B, A, C
Explanation
Binary search O(log n) < linear search O(n) < merge sort O(n log n) < bubble sort O(n²).More Data Structures and Algorithms questions
- Find the optimal solution of the fractional knapsack problem when the maximum capacity is 15.
- What is the maximum value of the items you can carry if the maximum weight allowed is 25 (fractional knapsack)?
- If a new item (P = 5, W = 2) is added, giving 8 items, and the capacity is 25, then the time of fractional knapsack in this case is ______
- The most efficient solution to the fractional knapsack problem with maximum capacity 15 is obtained using ___
- Which of the following statements about the knapsack problem is correct?
- How many different binary trees are possible with n nodes?