HW5: Solutions

5.1

  1. First-in/last-out
  2. Last-in/First-out

5.2 Expression Evaluation (infix and postfix), syntax recognition in compilation, function call, return and local variables.

5.5 Reverses the order of the integers on stack S.

5.8 Remove from the stack all data elements having value n.

5.12

  1. First-come/first-serve
  2. first-in/First-out

5.13 b. operating system job scheduler

c. simulation of waiting lines.

5.14 <line 1> 3 <line 2> 18 <line3> 22 <line 4> 9

5.16 Makes a copy of Q1 in Q2.

5.17

  1. Deletion: Item=15 List: 45 30 50 25 65
  2. Insertion of 20 List: 45 30 50 25 65 20
  3. Deletion: Item=20 List: 45 30 50 25 65
  4. Deletion: Item=25 List: 45 30 50 65