Update later...
- Example of Stack
- By Nguyen Anh Tuan, view more
*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:
- 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.
- Create a Stack to control the loop operation in program, recursion; prevent infinite loop.