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 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
Step: 1
1 Given int fun1 int n if n 1 return 0 else return 1 fu...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Building Java Programs A Back To Basics Approach
Authors: Stuart Reges, Marty Stepp
5th Edition
013547194X, 978-0135471944
Students also viewed these Mathematics questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App