Consider the following sequence of push and pop operations on an initially…

Consider the following sequence of push and pop operations on an initially empty stack S.S = push(S,1);S = pop(S);S = push(S,2);S = push(S,3);S = pop(S);S = push(S,4);S = pop(S);S = pop(S);Which of the following is the correct order in which elements are popped?

  1. A.

    1, 2, 3, 4

  2. B.

    1, 3, 2, 4

  3. C.

    1, 3, 4, 2

  4. D.

    4, 3, 2, 1

Attempted by 679 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…