Question: Following is java like pseudo code of a method that takes a number as an argument, and uses a stack Sto do processing. void fun(int

 Following is java like pseudo code of a method that takes

Following is java like pseudo code of a method that takes a number as an argument, and uses a stack Sto do processing. void fun(int n) (Astack s= new Astack(:// Say it creates an empty stacks while (n > 0) { // This line pushes the value of n%2 to stack S s.push(n%2); n = n/2;} // Run while Stack S is not empty while (!s.isEmpty) system.out.print(s.pop(); // pop an element from S and print it } What does the above method do in general? Select one: O A. Prints binary representation of n in reverse order O B. Prints binary representation of n O C. Prints the value of log n OD. Prints the value of log n in reverse order

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!