Skip to main contentSkip to solution

Arrange the following time complexities in increasing order(from low to high):

A. Bubble Sort (worst case)

B. Binary Search (worst case)

C. Linear Search (worst case)

D. Hashing (without collision)

Solution

✅ Correct Option: 2

Hashing (without collision) is O(1)O(1)

Binary Search (worst case) is O(log⁡n)O(\log n)

Linear Search (worst case) is O(n)O(n)

Bubble Sort (worst case) is O(n2)O(n^2)

So O(1)<O(log⁡n)<O(n)<O(n2)O(1) < O(\log n) < O(n) < O(n^2) gives the order D, B, C, A.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question