WELCOME
U A P C S E
Linked List with Stack in JAVA
Aboutme
Topic
LL
Stack
WorkFlow
Code
Aboutme
Topic
LL
Stack
WorkFlow
Code
MESSAGE FROM
Md. Moshiur Rahman Hridoy
ID : 17101016
Section :A
Aboutme
Topic
LL
Stack
WorkFlow
Code
321
Linked List
What is Linked
List
Stack
What is Stack
How
Can We Connected
Linked List & stack.
Aboutme
Topic
LinkedList
Stack
WorkFlow
Code
Data 1 Data 2 Data 3
about
Topic
LL
Stack
WorkFlow
Code
What is Stack
Stack
Overflow
Stack Under
Flow
01 02 03
LIFO
A stack is a container of
objects that are inserted and
removed according to the last-
in first-out (LIFO) principle. In
the pushdown stacks only two
operations are allowed: push
the item into the stack, and pop
the item out of the stack
Exceeded memory
A stack overflow error can
occur in a computer program
due to excessive memory
usage.
Element doesn’t exist
An error condition that occurs
when an item is called for from
the stack, but the stack is
empty.
about
Topic
LL
Stack
WorkFlow
Code
Aboutme
Topic
LL
Stack
WorkFlow
Code
class Stack
{
static final int MAX = 1000;
int top;
int a[] = new int[MAX]; // Maximum
size of Stack
boolean isEmpty()
{
return (top < 0);
}
Stack()
{
top = -1;
}
boolean push(int x)
{
if (top >= MAX)
{
System.out.println("Stack Overflow");
return false;
}
else
{
a[++top] = x;
return true;
}
}
int pop()
{
if (top < 0)
{
System.out.println("Stack
Underflow");
return 0;
}
else
{
int x = a[top--];
return x;
}
}
class Main
{
public static void main(String args[])
{
Stack s = new Stack();
s.push(10);
s.push(20);
s.push(30);
System.out.println(s.pop() + " Popped from stack");
}
}

Linked list with stack in java