Linked List implementation of Stack Data Structure in Java

stack is a simple data structure for storing data. In stack, the order in which the data arrives is important. A pile of books is a good example of stack. Astack is an ordered list in which insertion and deletion are done at one end, where end is called top. The last element inserted is the first one to be deleted. Hence, it is called Last in First Out (LIFO) or First in Last Out (FILO) list

In this post, we’ll see the other way of implementing Stack is by Linked List. This is continuation of the previous post about Array implementation of Stack.
In this implementation, push operation is implemented by inserting element at the beginning of the list. Pop operation is implemented by deleting the node from the beginning.
Even you can throw exception instead of printing message in case of pop operation when stack is empty.

Click here to read more


Leave a Reply

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

You are commenting using your 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