General Algorithms Flashcards

1
Q

What does it mean for an algorithm to be stable

A

two items of the same value are not swapped

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

what does it mean for an algorithm to be inplace

A

it uses no extra memory

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

explain the Partition step in quick sort

A

Set a variable i for the index of the most recently found value lower than the pivot (update everytime you find a new value lower)

loop through the list placing items lower at i+1 and update i
leave items larger alone

then swap the value at i+1 with the pivot (typically the last value)

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

what is sterlings approximation

A

n! = sqrt(2pi n)(n/e)^n

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