# UGCNET-June2010-II: 21

1 vote
1.4k views

If we have six stack operationspushing and popping each of $A, B$ and $C$-such that push $(A)$ must occur before push $(B)$ which must occur before push $(C)$, then $A, C, B$ is a possible order for the pop operations, since this could be our sequence : push $(A)$, pop $(A)$, push $(B)$, push $(C)$, pop $(C)$, pop $(B)$. Which one of the following orders could not be the order the pop operations are run, if we are to satisfy the requirements described above?

1. $ABC$
2. $CBA$
3. $BAC$
4. $CAB$
in DS
recategorized

1 vote
As question says, push (A) (A) must occur before push (B) (B)which must occur before push (C)

So option a is valid as

first push A than pop A

Than push B again pop B

Than push C again pop c

So here ABC is valid pop sequence

(B)option

Push A

Push B

Push C

Pop all we will get CBA sequence so its valid

Option (c)

Push A

Push B  now pop B than again pop C  now push C now pop C

So  BCA is valid sequence

(D) option is not valid

Below is the dependency graph

## Related questions

1 vote
1
835 views
Which of the following expression is represented by the parse tree ? $(A + B) ^{*} C$ $A + ^{*} BC$ $A + B * C$ $A * C + B$
1 vote
In a $B$ tree of order $5$, the following keys are inserted as follows : $7, 8, 1, 4, 13, 20, 2, 6$ and $5$ How many elements are present in the root of the tree ? $1$ $2$ $3$ $4$
A chained hash table has an array size of $100$. What is the maximum number of entries that can be placed in the table ? $100$ $200$ $10000$ There is no upper limit
In a complete binary tree of n nodes, how far are the two most distant nodes ? Assume each edge in the path counts as ! About $\log_{2} n$ About $2 \log_{2} n$ About $n \log_{2} n$ About $2n$