zero_shubham1

java program to implement stack with linked-list

Apr 18th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. package stack_withLL;
  2.  
  3. class node{
  4.     protected int data;
  5.     protected node link;
  6.    
  7.     public node(){
  8.         data = 0;
  9.         link = null;
  10.     }
  11.    
  12.     public node(int v, node n){
  13.         data = v;
  14.         link = n;
  15.     }
  16.     /*  Function to get link to next node  */
  17.     public node getLink()
  18.     {
  19.         return link;
  20.     }    
  21.     /*  Function to get data from current Node  */
  22.     public int getData()
  23.     {
  24.         return data;
  25.     }
  26.      
  27. }
  28.  
  29. public class linked_stack {
  30.     protected node top;
  31.     protected int size;
  32.    
  33. }
Add Comment
Please, Sign In to add comment