Question: Q1 [5 pts] What does the following Algorithm fragment do when n is 32? Trace the program and show your work to get full
![Q1 [5 pts] What does the following Algorithm fragment do when n](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2022/08/6306fdfa963cf_1661402617950.jpg)
Q1 [5 pts] What does the following Algorithm fragment do when n is 32? Trace the program and show your work to get full credit int funl (int n) { } if (n==1) else return 0; return 1 +fun1(n/2); Q2 [5 pts] What does the following code fragment prints if a linked list is 1 2 3 4 56 Trace the program and show your work to get full credit def funl (head): if (head == None) : return funl (head.next) print (head.data, end "1 = ") Q3 [5 pts] Given a non-negative int n, write and test a recursive python function sumDigit that returns the sum of its digits recursively do not use iterations. What is the time complexity for your algorithm?
Step by Step Solution
3.44 Rating (160 Votes )
There are 3 Steps involved in it
1 Given int fun1 int n if n 1 return 0 else return 1 fu... View full answer
Get step-by-step solutions from verified subject matter experts
