comp.lang.ada
 help / color / mirror / Atom feed
From: nospam@somewhere.ia.us (Robert S. White)
Subject: Re: Please read this..thank you
Date: 1997/11/02
Date: 1997-11-02T00:00:00+00:00	[thread overview]
Message-ID: <63ihp7$pq2$1@flood.weeg.uiowa.edu> (raw)
In-Reply-To: 345BBEC0.1D12@upnaway.com


In article <345BBEC0.1D12@upnaway.com>, Sho@upnaway.com says...
>
>Dear Ada Programmers,
>
>Could you please help me with the algorithms on how to convert Infix to
>a Postfix expression? examples:
>
>Infix: 1 + 2 + 3
>Postfix: 1 2 3 + +

  The most common technique (for this very old homework problem) is
to push operations up on one stack and data up on another while
examining the precedence of the must recently pushed operation with
the newest encountered operation - and immediately doing the operation
if appropriate.  I remember helping people with their Pascal homework
on this type of problem in the early 80's.  I hope you can take this 
general approach and flesh it out to code the solution to your problem.

>If anyone has done a program that converts infix to postfix could you
>please help me via email or newsgroup? 

  We really should not do this - although I am sure that I have seen
such programs in learning to program books.  For example check out 
Michael Feldman's book "Ada 95 Problem Solving and Program Design" 
in chapter 14.6 Problem Solving: Stacks and Queues around page 683 
he has an example, CHECKING FOR BALANCED PARANTHESES, which uses 
stacks that should give you some clues and useful code snippets.

Thank you for your time and
>consideration.^_^

  Good luck, work hard, and have fun :-)
_____________________________________________________________________
Robert S. White         -- An embedded systems software engineer
e-mail reply to reverse of: ia us lib cedar-rapids crpl shift2 whiter





  reply	other threads:[~1997-11-02  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-02  0:00 Please read this..thank you Sho
1997-11-02  0:00 ` Robert S. White [this message]
1997-11-07  0:00 ` Howard W. LUDWIG
1997-11-10  0:00   ` John M. Mills
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox