Aspire Faculty ID #17208 · Topic: AMU MCA 2020 · Just now
AMU MCA 2020

The following sequence of operation is performed on stack:

push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop.

The sequence of popped out values are:

Solution

Start: []

push(1) → [1]

push(2) → [1,2]

pop → 2 → [1]

push(1) → [1,1]

push(2) → [1,1,2]

pop → 2 → [1,1]

pop → 1 → [1]

pop → 1 → []

push(2) → [2]

pop → 2 → []

Popped sequence: 2,2,1,1,2

Previous 10 Questions — AMU MCA 2020

Nearest first

Next 10 Questions — AMU MCA 2020

Ascending by ID
Ask Your Question or Put Your Review.

loading...