### Implement Stack Using Linked List - The Coding Shala

Home >> Data Structures >> Implement Stack using Linked List In this post, we will learn how to Implement Stack Using Linked List and will write a Java Program for the same. Implement Stack using Linked List We will implement Stack operations using LinkedList. If we implement using a linked list then the stack can grow and shrink dynamically but it requires extra memory because of pointers involvement. Java Program: class MyStack { Node root ; //linked list node class Node { int data ; Node next ; Node ( int data ) { this . data = data ; } } boolean isEmpty () { return root == null ; } void push ( int x ) { Node newNode = new Node ( x ); //if stack is empty //make this as root node if ( root == null ) { root = newNode ; } else { //add ne