Insertion Sort exhibits _______ complexity when the input array is already sorted.
- Constant
- Linear
- Logarithmic
- Quadratic
Insertion Sort exhibits constant complexity (O(1)) when the input array is already sorted. In such cases, there is no need for many comparisons or swaps as elements are already in their correct positions.
Loading...
Related Quiz
- What is the difference between a singly linked list and a doubly linked list?
- Edit Distance is often used in spell checkers and _______ correction systems.
- What is the primary objective of the A* search algorithm?
- Explain the significance of the top pointer in a stack data structure.
- How can you optimize selection sort to improve its performance?