Data Structure and Algorithm - Stack
Réussis tes devoirs et examens dès maintenant avec Quizwiz!
Push
Add a given element onto the stack
Peek
Copies element at the top of the stack and return it but does not delete it
Stack
Linear list in which data items can only be accessed at one end , called top of the stack. Follows Last In, First Out (LIFO) mechanism
Pop
Remove the top element of the stack and return it
Size
Return the number of elements in the stack
Basics operations
1. Peek 2. Push 3. Pop
Stack Applications (4)
1. Reversing data 2. Parsing data - translate source program to machine language 3. Postponing data usage - evaluation 4. Backtracking - computer gaming