• Create Account

Posted 14 October 2012 - 09:50 PM

Ok so I had a quick question on how some of y'all would attack this.

This is a school assignment so I won't be giving code nor do I really want any code. Just trying to get some ideas on some of the best ways to implement this small thing.

The school assignment really just focuses on us building our own stack, which I got done really fast and I like how it is designed (for a simple Linked List based Stack). We are using this stack for infix to postfix conversion which I also understand and can code. The only thing that is giving my brain fits right now is a good way to implement operator precedence. I need to check whether or not the operator I just read in the input is of higher precedence than the operator that is on top of the stack. What would be some ways to do some quick checking for this?

Even though I am not expecting code, C++ is the language. Though just some ideas on how to put this in code would be great.

If you have any question then just ask.

Thanks,

EDIT: to make things simpler right now we can ignore parenthesis

Posted 14 October 2012 - 09:48 PM

Ok so I had a quick question on how some of y'all would attack this.

This is a school assignment so I won't be giving code nor do I really want any code. Just trying to get some ideas on some of the best ways to implement this small thing.

The school assignment really just focuses on us building our own stack, which I got done really fast and I like how it is designed (for a simple Linked List based Stack). We are using this stack for infix to postfix conversion which I also understand and can code. The only thing that is giving my brain fits right now is a good way to implement operator precedence. I need to check whether or not the operator I just read in the input is of higher precedence than the operator that is on top of the stack. What would be some ways to do some quick checking for this?

Even though I am not expecting code, C++ is the language. Though just some ideas on how to put this in code would be great.

If you have any question then just ask.

Thanks,