Skip to content

Latest commit

 

History

History

stack

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Stack

Concept

Update later...

Examples

With CPP

  1. Example of Stack

Exercises

*Note: Stack always has a clear (a method is used to clear all nodes), default constructor, arguments constructor and destructor (if the language support).

Create some classes:

  • Person has name and age.
  • Animal has name, age and breed.
  • Vehicle has name, color and speed.

Questions:

  1. Create a generic Stack has pop, push, getSize, isEmpty and getTop. Initializer 3 stack of People, Animals and Vehicle (each stack has arbitrary numbers of items). Perform all methods of Stack.
  2. Create a Stack to control the loop operation in program, recursion; prevent infinite loop.