Lecture 19 Objectives


At the end of today's class you should

KNOW:

BE ABLE TO:

Sample Exam Question:

A client program executes the following code:

   stack< int > s; 
   s.push(1);
   s.push(2);
   s.push(3);
   cout << s.top( );
   s.pop();
  1. Suppose that s is represented by a partially filled array. Draw the state of the private member variables of s after the code executes:
               _______            __________________________________
          used|       |      data|      |      |      |      |      |
              |_______|          |______|______|______|______|______|
                                   [0]    [1]    [2]    [3]    [4]
    
    
  2. Suppose that s is represented by a linked list. Draw the state of the private member variables of s after the code executes:
                   _______      
          head_ptr|       |  
                  |_______|