Selection Sort Flashcards

1
Q

Which sorting algorithm repeatedly selects the smallest (or largest) element form the unsorted portion and swaps it with the first unsorted element?

A

selection sort

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

What is the minimal number of swaps in selection sorting?

A

n-1

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

What is the maximum number of swaps required?

A

n-1

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

What is the best case time complexity for selection sorting?

A

O(n^2)

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

For best case, selection sort performs _______ comparisons to find the minimum.

A

n(n-1)/2

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

What is the worst-case scenario for selection sorting?

A

O(n^2)

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

Why is selection sort not stable?

A

element may not be in order because of swapping

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

Is selection sorting sufficient for large datasets?

A

no!

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