COM SCI 32 Lecture Notes - Lecture 5: Fifo (Computing And Electronics), Postfix (Software), The Queue

75 views5 pages

Document Summary

Cs 32 - lec 5 - stacks & queues. Stacks: last in first out (stack of trays) - items are always added to one end. Infix postfix (15+6) * 5 15 6 + 5 * Queue: first in, first out (line of customers) has a front and a rear. Look at the back item in the queue. Output: postfix string (initially empty: start with the left-most item. If == number: append to the end of postfix string followed by a space. If == operator && stack is empty: push operator onto stack. If == operator && stack is not empty. 5: pop all operators with greater or equal precedence off the stack, append them onto the postfix string, stop when reach an operator w/ lower precedence or a ( , push the new operator onto the stack. Output: answer: start with the left-most item. If == number: push it onto the stack.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents