Hi all,

Here is a permuatation related question.

Suppose the set is {a,b,c};

At a given point of time either u can push an
elemnt on to the stack or pop of the element.
While pushing the elements u have to follow the
order a,b,c as given in the set.

When u pop the element u will print it to the
output array.

one possible sequence of operations is

push(a),push(b),pop(),push(c),pop(),pop()

The permuation obtained by above combination is

 {b,c,a}.

But out of 6! permuations possible one invalid
permutation  is {c,a,b} (guess how?)

So how to print all valid permuations with the
above constaraints?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.

Reply via email to