Insertion Sort Flashcards

1
Q

Which sorting algorithm builds a sorted portion by inserting each element into the correct position?

A

Insertion sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the best-case time complexity for insertion sort?

A

O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

For the best-case time complexity for an insertion sort, the inner loop executes ____ times

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Is an iteration sort efficient for nearly sorted data?

A

yes!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the worst-case time complexity for an insertion sort?

A

O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is insertion sort considered a stable sort?

A

yes!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Is insertion sort good for large datasets?

A

no!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the space complexity for insertion sort?

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly