COMP171 Data Structures and Algorithm

Section L2, Fall 2005

 


Assignment 1:

  • Two sample programs 

      List.zip(a simple program using linked list)
      Stack.zip(A simple program using stack)

  • PA1a Sample Input and Output
Input:
 
      1 8 16 7 9 5 4 1 0 0 -1 6 7 8 4 3 1 2 0 0 -1
      2 -5 9 9 8 -6 1 1 0 0 -1 -3 9 7 3 -2 0 0 -1
      3 8 6 5 3 -1 1 1 0 0 -1 7 3 -9 0 0 -1
 
      Output:
 
      8 16 7 9 6 7 13 4 3 1 3 0 0 -1
      -2 9 9 8 -7 3 -6 1 3 0 0 -1
      56 9 -37 6 -7 4 -38 3 9 1 -9 0 0 -1
  • PA1b Sample Input and Output

Input:

      a+b*(c+d)-e*f
      a*(b-c*d)+e*f
      a-b+c*d*f-g

Output:

      abcd+*+ef*-
      abcd*-*ef*+
      ab-cd*f*+g-