Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2023
Questions

Q44

MSQ2 marksAlgorithms

Consider functions Function_1\textsf{Function\_1} and Function_2\textsf{Function\_2} expressed in pseudocode as follows: Function_1

while n>1 do
    for i=1 to n do
        x = x + 1;
    end for
    n = ⌊n/2⌋;
end while

Function_2

for i = 1 to 100 * n do
    x = x + 1;
end for

Let f1(n)f_{1}(n) and f2(n)f_{2}(n) denote the number of times the statement “x = x + 1”\textsf{“x = x + 1”} is executed in Function_1\textsf{Function\_1} and Function_2,\textsf{Function\_2}, respectively. Which of the following statements is/are TRUE?\text{TRUE}?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.