Sunday, February 8, 2009

STACK DATA STRUCTURE



Illustration of the stack data structure [WIKI]


Definition/Concept
Stack is an abstract data type and data structure. It’s principle is a LIFO (w/c means last in first out). Among other uses, stacks are used to run a Java Virtual Machine, and the Java language itself has a class called "Stack", which can be used by the programmer. "The stack is ubiquitous."
[WIKI]
The meaning of ubiquitous is that it is omnipresent or present everywhere. "It also means universal." [blurtit.com]

How do we connect a stack data structure in a real world representation??
In connecting a stack data structure in areal worls representation, just imagine pingpong balls put into a straight glass tube or your plates at home being arranged vertically or just a pile of hollowblocks. If you could really imagine, the first thing that you put on your pile is the last thing you could pull out and the last thing you put is the first that you could pull out. That is the concept of a stack..



..in our class discussion for the stack data structure, pop is the same as deletion and push is just the same with inserting and you cannot cheat on this kind of structure, you really have to go through it's method of deleting elements.♥♥♥♥
..iv'e also learned about different stack operations:
•isEmpty()//checking if the list is empy or null
•push() //the same as insertion operation
•pop() //the same as deletion operation
•top() //operation that will determine the top element of the list but will not delete it







No comments:

Post a Comment