New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Mr. Molly Kessler


Mr. Molly Kessler
GPA 3.62

W. Duncan

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

W. Duncan
Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 4 page Class Notes was uploaded by Mr. Molly Kessler on Tuesday October 13, 2015. The Class Notes belongs to CSC 1254 at Louisiana State University taught by W. Duncan in Fall. Since its upload, it has received 8 views. For similar materials see /class/222858/csc-1254-louisiana-state-university in ComputerScienence at Louisiana State University.

Similar to CSC 1254 at LSU

Popular in ComputerScienence


Reviews for COMP SCI 11 WITH C++


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/13/15
CBC 1254 Lecture 16 An Application Using The Stack ADT Operations October 27 2009 0 Designing a Simple Calculator 0 Evaluating Post x Expressions 0 Converting ln x to Post x Expressions 0 APPENDIX The Calculator Code 1 Designing a Simple Calculator In this lecture we will use the ADT stack operations to solve the problem of evaluating simple arithmetic expressions As is the case with using any ADT7 we are not going to make any assumptions regarding the ADT7s implemen tation The strategy we will employ is to rst convert the in x arithmetic expression to a post x expression The stack operations work more naturally with post x expressions Evaluating in x expression is a more involved prob lem For the purpose of this lecture we will restrict ourselves to the following binary operations 7 7 7 and Exponentiation and unary operators will be disallowed to make our lives somewhat easyl Here is a summary of our simplifying assumptions 0 The input is a syntactically correct post x expression 0 No unary operators are present 0 No exponentiation is allowed 0 Operands are positive integers 2 Evaluating Post X Expressions Here is the pseudocode algorithm that evaluates post x expressions for each token Ch in the expression if Ch is an operand Push value that operand Ch represents onto stack else Ch is an operator named Up evaluate and push the result Uperand2 top of stack Pop the stack Uperandl top of stack Pop the stack Result Uperandl Up Uperand2 Push Result onto stack Upon termination of the algorithm7 the value ofthe expression will be on the top of the stack 3 Converting In X to Post X Expressions Here is a high level description of what we must do to convert an expression written in in x notation to one written in post x notation H When you encounter an operand7 append it to the output expression PE 3 Push each 77 77 onto the stack S 00 When you encounter an operator7 if S is empty7 push the operator onto the S However7 if S is not empty7 pop operators of greater or equal precedence off S and append them to PE Stop when you encounter 77 77 or an operator of lower precedence 4 When you encounter 77777 pop operators off the stack and append them to the end of PE7 until you encounter the matching 7777 2 5 When you reach the end of the PE7 you append the remaining contents of the stack to PE Here is a pseudocode algorithm that converts an in x expression to post x mnr for each Ch in the infix form switchCh case operand append operand to the end of PE PE PE Ch represents appending break case quotquot2 push Ch onto S break case quotquot while top of S is not quotquot PE PEtop of S pop S pop S break case operator while S is not empty AND top of S is not quotquot AND PrecedenceCh lt Precedencetop of stack PE PEtop of S pop S push Ch onto S break append to PE the operators remaining in the stack while S is not empty PE PEtop of S pop S


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.