ITA - Week 5 Flashcards

1
Q

Divide and Conquer

A

A problem is divided into several subproblems
The subproblems are solved (typically recursively)
The subproblems are combined

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

Known divide and conquer algorithms

A

Binary search

Mergesort

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

What is Mergesort

A

The problem is divided into 2, both halves are solved and later recombined

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

Merge subroutine

A

Get 2 pointers, check the smaller number and add to final list while increasing pointer by 1.

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

Divide and conquer x^8

A

x^8 = (((x^2)^2)^2)

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

Divide and conquer x^2r

A

((x^2)^2) - r times

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

Algorithm for exponention

A
If exponent (n) is odd multiply result by x and decrease n by 1
If exponent (n) is even square current value of x and divide n by 2
Repeat until n = 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly