Data Structures | Stack | Question 1
Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing.
(n > 0)
n = n/2;
What does the above function do in general?
(A) Prints binary representation of n in reverse order
(B) Prints binary representation of n
(C) Prints the value of Logn
(D) Prints the value of Logn in reverse order
Answer: (B) Explanation: See method 2 of https://www.geeksforgeeks.org/binary-representation-of-a-given-number/ for explanation.