stack using linked list

Java Program to Implement Stack using Linked List

Stacks and Queues are ADTs (Abstract Data Types). We have already seen how Stacks and Queues can be implemented using arrays. In this tutorial we will see how to implement stack using linked list.

What is ADT ?

ADT (Abstract Data Types) in data structures terminology we can say it is a way of looking at a data structure, focusing on what the data structure does instead of how it does. Stacks and Queues are examples of ADTs.

Stack using Linked List: Example

Output

Note:

Similar to push() and pop() operations of Stack, using linked list we could carry out operations like llist.insertFirst(data) and llist.deleteFirst().

Recommended Posts

References

Leave a Reply

avatar
  Subscribe  
Notify of