GATE CS 2018 (Forenoon) — Question 55

AlgorithmsAsymptotic Analysis (O, Omega, Theta Complexities)NAT2 marksHard

Consider the following program written in pseudo-code. Assume that x and y are integers.
c
1Count(x,y) {
2    if (y != 1){ 
3        if (x != 1) {
4            print("*");
5            Count(x/2, y);
6        }
7        else {
8            y = y-1;
9            Count(1024, y);
10        }
11    }
12}
13
The number of times that the print statement is executed by the call Count(1024,1024) is _____.
Practise the full 2018-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on Asymptotic Analysis (O, Omega, Theta Complexities)Timed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group