[Q]Sorting
Moderator: Board moderators
[Q]Sorting
Is there an algo to sort a sequence using only two stacks (with Push() and Pop()method ). Pls help me.
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
If I think correct not all sequences are possible to sort using two stacks.
Best regards
DM
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
hey ,
it is possible to sort a sequence using two stacks and 2 extra variables . it is very easy to implement bubble sort using only 2 stacks and 2 variables .but to implement it with only 2 stacks [not using any temporary variables ] is impossible . so if u r need , can allow two extra variable i can get the algo for u ......
Bye
Riyad
it is possible to sort a sequence using two stacks and 2 extra variables . it is very easy to implement bubble sort using only 2 stacks and 2 variables .but to implement it with only 2 stacks [not using any temporary variables ] is impossible . so if u r need , can allow two extra variable i can get the algo for u ......
Bye
Riyad
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN