in DS
1,077 views
1 vote
1 vote
The number of permutations can be obtained in the output using stack assuming that input contains elements 1, 2, 3, 4, 5, 6 in any order such that 3 will poped out from stack at 3rd position are _______ (assume one element enter in stack only one time).
in DS
1.1k views

4 Comments

what would be the answer if we inserted the elements in ascending order i.e.. 1,2,3,4,5,6 order ? 

i asked this question before, this answer is for the above question. 

0
0

@OneZero

take this case push 1 , pop 1

push 2 , push 3 , push 4 ..   pop 4 , pop 3

so first two positions are 14 

 

0
0
Yes, you are right, my answer is wrong.
0
0

1 Answer

0 votes
0 votes
NOS of permutation is 120.

Related questions