Week 3 Flashcards

1
Q

Sorting Algorithm (Mergesort)

A

1.Divide the list recursively into two equal halves until we have one element in each group
2.Merge the smaller sorted lists into larger sorted lists and repeat until one sorted list

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

Sorting Algorithm
(Quicksort)

A

Initially one of the data items is selected as a pivot. All data items less than the pivot are placed on the left-hand side of the array and all other data items are placed on the right-hand side of the array. The pivot is then placed between the two groups

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

Choosing the pivot

A

*Always select the first element as the pivot
*Always select the last element as the pivot
*Select any random element as the pivot
*Select the median element as the pivot

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

Backtracking Algorithm

A

The algorithms attempts to complete a search for a solution to a problem by constructing partial solutions, always ensuring that the partial solutions remain consistent with the requirements of the problem. The algorithm then attempts to extend a partial solution towards completion, but when an inconsistency with the requirements of the problem occurs, the algorithm backtracks by removing the most recently constructed part of the solution and trying another possibility

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