Do all ten problems.
Problem | You got | Out of |
---|---|---|
1 | 10 | |
2 | 10 | |
3 | 10 | |
4 | 10 | |
5 | 10 | |
6 | 10 | |
7 | 10 | |
8 | 10 | |
9 | 10 | |
10 | 10 | |
TOTAL | 100 |
for (int i = 1; i * i <= n; i++) { for (int j = 1; j <= n; j += j) { System.out.println("*"); } }
def c(n): return 0 if n==1 else c(n/2 if n%2==0 else 3*n+1)+1Write this function tail-recursively.
is_prime
or isPrime
that
returns a boolean value indicating whether its argument is prime or not. Then
answer whether there are any disadvantages to using this function. Okay there
is a huge one. What is it? Answer using technical language and back it up with
real numbers.