You are here:

C++/Stack question

Advertisement


Question
Hi,
I asked you a Java Q before and you got me started pretty well. I've already asked the Java people but they haven't got back to me yet.
I was wondering if you know some good links or examples on stacks?
something like converting an infix expression to a postfix or prefix expression or vise-versa?
I need to implement a stack class that does all these conevrisions, could you help me get started on it?
thanks
Connie

Answer
right from jdk 1.0, java has has a built-in stack class java.util.Stack
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Stack.html

however, if you want to implement one of your own, it is quite easy.
see: http://www.cs.princeton.edu/introcs/43stack/Stack.java.html

Dijkstra's "shunting yard" algorithm is the classical algorithm to convert from infix to postfix.
http://en.wikipedia.org/wiki/Shunting_yard_algorithm
http://penguin.ewu.edu/cscd300/Topic/Stack/WikiExtract.html  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.