Quick Sort + Divide and conquer Flashcards

(9 cards)

1
Q

How does Quick Sort work?

A

Selects an element, usually the central element and divides the input around it.

Elements smaller than the the pivot are put on the left of the pivot and larger on the right.

process repeated recursively

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

What is the pivot

A

The element selected in quicksort

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

Downsides of quicksort

A

Not very fast

same time complexity as bubble sort with 0(n^2)

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

What is divide and conquer?

A

Problem solving technique to break a problem down into smaller more managable sub problems and then reassemble the full solution.

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

Divide (Divide and conquer)

A

Halving the size of the problem with every iteration

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

Conquer

A

Where each sub problem is solved ofter recursively.

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

Merge

A

All teh solutions to the subproblems are recombined during this stage.

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

Where is it used?

A

In binary search
quick sort
merge sort

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

Divide and conquer advantages

A

Simplifies very complex problems

the time take to solve the problem does not increase at the rate of the difficulty of the problem

0(logn)

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