CMPU-203: Introduction to Computer Science III

Quiz #6
Due: Monday, Oct 29

  1. Read carefully the definition of a stack. What is wrong with the following code:
      stack<int> s;
      stack<int>::iterator i;
    
      s.push(8);
      s.push(7);
      s.push(4);
    
      for(i=s.begin(); i!=s.end(); i++)
        cout << *i;
    

  2. Think of some real life examples of things that operate as a stack, as a queue, and as a priority queue. Your examples do not have to be related to computers, but they can be. You should have at least one example of each.

  3. What is the difference between a priority queue and a set in STL?