Insertion Sort Flashcards
1
Q
Which sorting algorithm builds a sorted portion by inserting each element into the correct position?
A
Insertion sort
2
Q
What is the best-case time complexity for insertion sort?
A
O(n)
3
Q
For the best-case time complexity for an insertion sort, the inner loop executes ____ times
A
0
4
Q
Is an iteration sort efficient for nearly sorted data?
A
yes!
5
Q
What is the worst-case time complexity for an insertion sort?
A
O(n^2)
6
Q
Is insertion sort considered a stable sort?
A
yes!
7
Q
Is insertion sort good for large datasets?
A
no!
8
Q
What is the space complexity for insertion sort?
A
O(1)