Simple Algorithms Flashcards

1
Q

What is a way to find the approximate solution of a cube root?

A

While the absolute of (guess cubed - cube) is >= epsilon, increment guess by a smaller amount than epsilon

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

How do you perform a bisection search

A

Set answer = (high + low)/2. Loop, if answer squared is less than x; low equals answer otherwise high equals answer #Remember to rebind answer

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

How does bisection search convergence work?

A

first guess: N/2

nth guess: N/2^n

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

How do you convert decimal integers to binary?

A

Take a remainder relative to 2 and concatenate it into a string, divide by 2 (//) to shift to rigtht

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

When finding the root of a number what condition should stop the loop running?

A

while abs(guess**2 - x) >= epsilon:

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

How do you find the root of a solution using Newton-Raphson?

A

Set guess equal to x divided by 2.

Loop guess = (((guess**2) - x) / (2*guess))

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