Outline



infix expressions



integer operators



other kinds of expressions



algorithm for postfix computation



objects and primitives



Boxing



reading from a file



Reminder: stack ADT



array implementation, linked list implementation



StringNode class

    public class StringNode {
      private String item;
      private StringNode next;  
      /* methods */
    }



In-class exercise

On your own, draw a diagram of the result of this code:
StringNode node1 = new StringNode("string1", null);
StringNode node2 = new StringNode("string2", null);
StringNode node3 = new StringNode("string3", null);
StringNode node4 = new StringNode("string4", null);
StringNode node5 = new StringNode("string5", null);
node1.setNext(node5);
node2.setNext(node4);
node3.setNext(node2);
node4.setNext(null);
node5.setNext(node3);



Linked list stack implementation



Linked list stack performance



Java notes



Linked lists



Object usage



Stack usage: balanced parentheses



In-class exercise

everyone together, figure out what this code does