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

 

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 Expert Approved Answer
Step: 1 Unlock

1 Given int fun1 int n if n 1 return 0 else return 1 fu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!