Pow(x, n) Flashcards

1
Q

Pow(x, n)

A

a) n == 0 return 1
b) if n < 0 n = -n and x = 1/x
c) n%2 == 1 ? x * pow(x*x, n/2) : pow(x*x, n/2)

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