By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

just a task

P: 1
a want a some1 who can help me in doing a program of stack with template that will chech a word displays in stack is a palindrome or not compared with the 1 was inserted on stack and use c++,thanx
Aug 11 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 10K+
P: 11,448
a want a some1 who can help me in doing a program of stack with template that will chech a word displays in stack is a palindrome or not compared with the 1 was inserted on stack and use c++,thanx
Sure we can help you; the STL already contains stack templates so all you have
to do instantiate them for your type of data you want to push on to that stack.
(a char mayhap?).

If you want to use just 'pure' stacks only you need three of them:

1) push all the characters of the word on two stacks A and B;
2) clear stack B while pushing everything that came out of it on stack C;
3) keep on popping chars from stacks A and C until they're either empty or
until the popped off characters aren't equal.

Now it's your turn.

kind regards,

Jos
Aug 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.