Chapter #4 – Stacks and Queues

Stacks are used to solve the following problems:

  1. Delimiters.
  2. Reversing a linked list.
  3. Adding huge numbers.

Queues are used to solve the following problems:

  1. Detection of acrostic.

Piece of codes:

Stack<int, vector,int> >: The stack will use vector as its container

Stack<int, list<int> >: The stack will use list as its container

Priority_queue<MyClass, vector<MyClass>, greater<MyClass> >: will use operator > not < to prioritize elements.

Priority_queue<MyClass, vector<MyClass>, MyOperator>: will use the overloaded operator in MyOperator class to prioritize elements.

Download Chapter Case Study from this link.

Download solved chapter problems from this link.

One thought on “Chapter #4 – Stacks and Queues

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s