Comp. Science Programming and Technical Category

Consider the following program

n = b1b2b3….bm

int n, rev;

rev = 0;

while (n > 0) {

rev = rev * 10 + n %10;

n = n/10;

}

Read Solution (Total 0)

Comp. Science Other Question

Consider the following functions: f(n)= 3 n ? n ; g(n) = 3 n ? n n log 3 ; h(n) = n! Which of the following is true?

1. h(n) is O (f(n))

2. h(n) is O (g(n))

3. f(n) is O (g(n))

4. g(n) is not O (f(n))
Which of the following is true at the end of the ith iteration?

1. n = b1b2…bm–i and rev = bm bm–1….bm–i+1

2. n= bm–i+1….bm–1bm and rev = bm–i…b2b1

3. n= b1b2…bm and rev = bm…b2b1

4. none of these