Problem 1: Give an asymptotic estimate, using the O-notation, of the number of letters printed by the algorithms given b
Posted: Fri May 20, 2022 10:58 am
Problem 1: Give an asymptotic estimate, using the O-notation, of the number of letters printed by the algorithms given below. Give a complete justification for your answer, by providing an appropriate recurrence equation and its solution. (a) algorithm Print As(n) (b) algorithm Print Cs(n) if n <3 then if n < 2 then print("A") print("C") else else for j+1 to na for j1 to na do print("A") do print("C") for it1 to 5 do PrintCs( [n/2]) PrintAs( [n/4]) Print Cs( [n/2]) Print Cs( [n/2]) Prints([n/2]) (c) algorithm PrintDs(n) if n > 5 then print("D") if r is even then PrintDs( [n/5) PrintDs( [n/51) r+1 else PrintDs( [n/51) Print Ds( [n/5]) 22.0 In part (c), variable x is a global variable initialized to 1.