subject
Computers and Technology, 12.02.2020 01:58 xojade

Consider the following functions. For each of them, determine how many times is ‘hey’ printed in terms of the input n. You should first write down a recurrence and then solve it using the recursion tree method. That means you should write down the first few levels of the recursion tree, specify the pattern, and then solve. (a) def fun(n) { if (n > 1) { print( ‘hi’ ‘hi’ ‘hi’ ) fun(n/4) fun(n/4) fun(n/4) }}

(b) def fun(n) { if (n > 1) { for i=1 to n { print( ‘hi’ ‘hi’ ) } fun(n/4) fun(n/4) fun(n/4) }}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 20:30
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
question
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
question
Computers and Technology, 24.06.2019 13:00
Which best describes the condition under which the unicode output is the same as plain text ?
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
What is the most important for you to choose before you build a network?
Answers: 1
You know the right answer?
Consider the following functions. For each of them, determine how many times is ‘hey’ printed in ter...
Questions
question
Chemistry, 06.05.2020 08:44
question
Mathematics, 06.05.2020 08:44
question
English, 06.05.2020 08:45
question
Spanish, 06.05.2020 08:45
question
English, 06.05.2020 08:45