subject

Write a recursive procedure to implement the following function hotpo(n): hotpo(nhotpon/2) >l is even hotpo 3 n+1) n>1 n is odd n words: 1. The procedure takes a natural number n(n1) as input; 2. If n is even, divide it by 2 to getn12; 3. If n is odd, multiply it by 3 and add 1 to obtain 3n+1. 4. Repeat the process until the result is 1. The procedure stops and returns 1 For example, if the input value is 3, the procedure will have the following recursive calls: (hotpo 3) (hotpo 10)- (hotpo 5)(hotpo 16) (hotpo 8) (hotpo 4)(hotpo 2)- (hotpo 1) (1) Give the complete Scheme procedure and use comments to mark the size-n problem, stopping condition and return value, size-m problem, and construction of size-n problem solution. [5 points] (define hotpo (lambda (n)
(2) Modify the program in (1): Add a second parameter, named counter, into the hotpo procedure. The counter will count the number of iterations (the number of reentrances) that the procedure will execute before it stops. The revised procedure should return the counter value. For example, (hotpo 3 counter) should return 7. 3 points] (define hotpo (lambda (n counter)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
question
Computers and Technology, 23.06.2019 18:20
What is wi-fi infrastructure? a metropolitan area network that uses radio signals to transmit and receive data a communications technology aimed at providing high-speed wireless data over metropolitan area networks a means by which portable devices can connect wirelessly to a local area network, using access points that send and receive data via radio waves includes the inner workings of a wi-fi service or utility, including the signal transmitters, towers, or poles and additional equipment required to send out a wi-fi signal
Answers: 2
question
Computers and Technology, 24.06.2019 18:30
Is a type of bullying that takes place when a person intentionally posts negative information about another person that is not true.
Answers: 2
question
Computers and Technology, 25.06.2019 05:30
In 3-5 sentences describe how technology business professionals to be more efficient. include examples of hardware and software
Answers: 1
You know the right answer?
Write a recursive procedure to implement the following function hotpo(n): hotpo(nhotpon/2) >l is...
Questions
question
Mathematics, 06.03.2020 21:42