Run Time Analysis Flashcards

1
Q

What are we analysing when we do runtime notation?

A

The growth of the main function, as (for large inputs) constants do not matter

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

What does “f=O(g)” represent?

A

f grows at most as fast as g

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

What does “f=Ω(g)” represent?

A

f grows at least as fast as g

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

What does “f=Θ(g)” represent?

A

f grows equally as fast as g

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

What does “f=o(g)” represent?

A

f grows slower than g

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

What does “f=ω(g)” represent?

A

f grows faster than g

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

What are the two parts to a quick sort?

A
  • Partition

- Recursive Sorting

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

What are the steps for partitioning?

A
  • Pick an element
  • Rearrange so that everything to left is < the chosen element
  • Therefore everything to right is > the element
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is the sorting of the elements done after partitioning?

A

We need to look at both sides of the array, and look for two that are out of place.

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

What is important about the pivot?

A

We must always know where it is, as it can move.

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

How do we ensure that a quick sort is efficient?

A

We must always sort the shorter side of the array first

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

What is the worst case for a Quick sort if the sides are vastly different?

A

theta(n^2)

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

What is the worst case for a Quick sort if the sides are equal?

A

theta(n log n)

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