Sorting Algorithms Flashcards

1
Q

describe linear search

A

search list by inspecting each element

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

describe quicksort

A

partition array around pivot such that: Left side of pivot contains all the elements that are less than the pivot element Right side contains all elements greater than the pivot

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

describe merge sort

A

It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves.

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

describe insertion sort

A

builds the final sorted array (or list) one item at a time

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

what does in place mean

A

transforms input using no auxiliary data structure

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

what does stable mean

A

maintain the relative order of records with equal keys

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

give the merge sort complexities

A
worst O(n log n)
best O(n log n)
average O(n log n)
space O(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

give the insertion sort complexities

A
worst O(n^2)
best O(n)
average O(n^2)
space O(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly