Unit 5
Representation using sequential organisation
Operations
Stack Empty
Stack Full
Push Operation
Pop Operation
Applications of Stack
Expression
Infix to Postfix
Postfix to Infix
Postfix to Prefix
Infix to Prefix
Advantages
Recursion
Properties
Types of recursion
Direct Recursion
Indirect Recursion
Tall Recursion
Tree
Backtracking Algorithm Strategy
Representation using sequential
organisation
#define size 100
int stack[size], top=-1;
Preferred way:
Unit 5 1
, #define size 100
struct stack{
int stck[size];
int top;
}st;
Operations
Stack Empty
if(st.top == -1)
return true;
Stack Full
if(st.top == size-1)
return true
Push Operation
void push(int item){
st.top++;
st.stck[top] = item;
}
Pop Operation
int pop() {
int item;
item = st.stck[st.top]
st.top--;
return item;
}
Unit 5 2
Unit 5
Representation using sequential organisation
Operations
Stack Empty
Stack Full
Push Operation
Pop Operation
Applications of Stack
Expression
Infix to Postfix
Postfix to Infix
Postfix to Prefix
Infix to Prefix
Advantages
Recursion
Properties
Types of recursion
Direct Recursion
Indirect Recursion
Tall Recursion
Tree
Backtracking Algorithm Strategy
Representation using sequential
organisation
#define size 100
int stack[size], top=-1;
Preferred way:
Unit 5 1
, #define size 100
struct stack{
int stck[size];
int top;
}st;
Operations
Stack Empty
if(st.top == -1)
return true;
Stack Full
if(st.top == size-1)
return true
Push Operation
void push(int item){
st.top++;
st.stck[top] = item;
}
Pop Operation
int pop() {
int item;
item = st.stck[st.top]
st.top--;
return item;
}
Unit 5 2