Generalize the toBinary(n) algorithm to baseConvert(n, k) to recursively convert the integer n to base k. Assume that k ≥ 2 and n ≥ 0 are both integers, and follow the same algorithmic outline as in Figure 5.25. Prove using strong induction on n that if baseConvert(n, k) = hbℓ, bℓ−1, . . . , b0i with each
Figure 5.25: A reminder of the parity algorithm (from Figure 5.16), and an algorithm to convert an integer to binary
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here