SlideShare a Scribd company logo
Project of data structure
 STACK
Introduction
Application
Conclusion
Khadijatul Kobra Shila
I.D:142-15-3616
A stack is a data structure that stores data in
such a way that the last piece of data stored, is
the first one retrieved.
LAST IN FIRST OUT =LIFO
To get the bottom plate out,
you must first remove all
the plates above.
Example of stack
All these applications follow the LIFO logic.
REAL LIFE: Stacks are present everyday life.From
the books in a library, to the blank sheets of paper in a
printer tray systems are used STACK to complete their
acts.
#PILES OF BOOKS:
A book is added on top of a pile
of books, while removing a book
from a pile also takes the book on
top of a pile in everywhere.
#VISULAZE
STAGE:
TOP
Pile of Books
#SOURCE CODE:
void push(int *top, element
item)
{
/* add an item to the global
stack */
if (*top >=
MAX_STACK_SIZE-1) {
stack_full( );
return;
}
stack[++*top] = item;
}
Push
element pop(int *top)
{
/* return the top element
from the stack */
if (*top == -1)
return
stack_empty( );
/* returns and error key */
return stack[(*top)--];
}
Pop
Rahul Debnath
ID: 142-15-3484
RLATEDTO COMPUTER SCIENCE:
Below are a few applications of stacks in
computing.
#REVERSING STRING:
A simple application of stack is reversing strings.
To reverse a string , the characters of string are pushed onto
the stack one by one as the string is read from left to right.
To reverse the string ‘REVERSE’ the string is read
from left to right and its characters are pushed.LIKE:
E
S
R
E
V
E
R
REVERSE ESREVER
String is Reverse String
Stack
#VISULAZE
STAGE:
#define MAX 20
int top = -1;
char stack[MAX];
char pop();
void push(char);
main()
{
char str[20];
int i;
printf(“Enter the string : ” );
gets(str);
for(i=0;i<strlen(str);i++)
push(str[i]);
for(i=0;i<strlen(str);i++)
str[i]=pop();
printf(“Reversed string is : “);
puts(str);
void push(char item){
if(top == (MAX-1))
{
printf(“Stack Overflown”);
return;
}
stack[++top] =item;
}/*End of push()*/
char pop(){
if(top == -1)
{
printf(“Stack Underflown”);
exit(1);
}
return stack[top–];
}
Abu Zafor Tomal
I.D:142-15-3816
#Calculator Methodology:
Every arithmetic operation in calculator follow
the stack postfix notation.
*
+
9 6 39+6*3
Equation
Postfix string
Stack
Create Stack
While(not end of postfix notation){
ch = getch()
if(ch is operand)
push(ch)
else{
operand1 = pop()
operand2 = pop()
result = operand2 ch operand1
push(result)
}
}
Result = pop()
Abul Hasnath Limon
ID:142-15-3532
#Function ( recursive ):
A very good example of stack is Function.
Summation of positive integer can be implemented by
recursive function and the functions are stored in a stack to
maintain the sequence of summation.
When a function is called within a function then the previous
function is stored in a stack with it’s local variables.
Summation of positive numbers with code example:
#include <stdio.h>
int sum(int n);
int main(){
int num,add;
printf("Enter a positive integer:n");
scanf("%d",&num);
add=sum(num);
printf("sum=%d",add);
}
int sum(int n){
if(n==0)
return n;
else
return n+sum(n-1);
/*self call to function sum() */
}
Enter a positive integer: 5
15
Output
For better visualization of recursion in
this example:
sum(5)
=5+sum(4)
=5+4+sum(3)
=5+4+3+sum(2)
=5+4+3+2+sum(1)
=5+4+3+2+1+sum(0)
=5+4+3+2+1+0
=5+4+3+2+1
=5+4+3+3
=5+4+6
=5+10
=15
Sum(1)
Sum(2)
Sum(3)
Sum(4)
Sum(5)
All functions are pushed in stack
Umme Habiba
ID:142-15-3677
Implementation : Palindrome
A palindrome is a word, phrase, number, or other sequence of
Characters which reads the same backward or forward.
Allowances may be made for adjustments to capital letters,
punctuation, and word dividers.
Suppose :
ABCDCBA is a palindrome
FGHHGF is a palindrome
ASDFASDF is not a palindrome
C
I
V
I
C
C
I
V
I
C
PUSH POP
Stack Stack
Palindrome
Word
After pushing and popping, CIVIC word remain unchanged
#VISULAZE
STAGE:
Source code:
char stk[50];
int top=-1;
void push(char c){
top++;
stk[top]=c;
}
char pop(){
char c;
c=stk[top];
top–;
return c;
}
void main(){
char in[30],b[30];
int i;
printf(“nn ENTER UR STRINGt”);
gets(in);
for(i=0;in[i]!=‘’;i++){
push(in[i]);
}
i=0;
while(top!=-1){
b[i]=pop();
i++;
}
b[i]=‘’;
if(strcmp(in,b)==0){
printf (“n STRING is
PALLINDROME”);
}
else{
printf (“n STRING IS NOT
PALLNDROME”);
}
}
ThankYou
Ad

More Related Content

What's hot (20)

Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
Jeanie Arnoco
 
Linked list
Linked listLinked list
Linked list
KalaivaniKS1
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
Ashikapokiya12345
 
Queue ppt
Queue pptQueue ppt
Queue ppt
SouravKumar328
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
Abrish06
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
Subid Biswas
 
Binary Tree Traversal
Binary Tree TraversalBinary Tree Traversal
Binary Tree Traversal
Dhrumil Panchal
 
stack presentation
stack presentationstack presentation
stack presentation
Shivalik college of engineering
 
Linked list
Linked listLinked list
Linked list
akshat360
 
stack & queue
stack & queuestack & queue
stack & queue
manju rani
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
Apurbo Datta
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
kulachihansraj
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
topu93
 
Stack
StackStack
Stack
srihariyenduri
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Ashish Duggal
 
Heaps
HeapsHeaps
Heaps
Hafiz Atif Amin
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
somendra kumar
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
Omprakash Chauhan
 

Viewers also liked (19)

Data structures project
Data structures projectData structures project
Data structures project
sachinrajsachin
 
DS_Final_Project
DS_Final_ProjectDS_Final_Project
DS_Final_Project
星星 孫
 
Library management in Data structure
Library management in Data structure Library management in Data structure
Library management in Data structure
harshil1902
 
Garrage management system
Garrage management system Garrage management system
Garrage management system
Prateek Pandey
 
Calendar c
Calendar cCalendar c
Calendar c
Shanellebyrd
 
Data structures' project
Data structures' projectData structures' project
Data structures' project
Behappy Seehappy
 
Simple Calendar Application using C
Simple Calendar Application using CSimple Calendar Application using C
Simple Calendar Application using C
codewithc
 
62 how to track someone elses line messages
62 how to track someone elses line messages62 how to track someone elses line messages
62 how to track someone elses line messages
CatherineRai
 
Costume analysis
Costume analysisCostume analysis
Costume analysis
HannahO4997
 
آشنایی با زیرساخت کلید عمومی (PKI)
آشنایی با زیرساخت کلید عمومی (PKI)آشنایی با زیرساخت کلید عمومی (PKI)
آشنایی با زیرساخت کلید عمومی (PKI)
مرکز دولتی صدور گواهی الکترونیکی ریشه
 
how to spy on husbands line messages
how to spy on husbands line messageshow to spy on husbands line messages
how to spy on husbands line messages
CatherineRai
 
งานนำเสนชุมชน (แก้ไข)
งานนำเสนชุมชน (แก้ไข)งานนำเสนชุมชน (แก้ไข)
งานนำเสนชุมชน (แก้ไข)
Blsaw Wannarat
 
Biochemistry
BiochemistryBiochemistry
Biochemistry
qalikn
 
Algo labpresentation a_group
Algo labpresentation a_groupAlgo labpresentation a_group
Algo labpresentation a_group
Umme habiba
 
Erick hernandez
Erick hernandezErick hernandez
Erick hernandez
ErickHernandez1020
 
how to hack my husbands LINE
how to hack my husbands LINE how to hack my husbands LINE
how to hack my husbands LINE
CatherineRai
 
how to track line chat remotely
how to track line chat remotelyhow to track line chat remotely
how to track line chat remotely
CatherineRai
 
how to spy on LINE chat history
how to spy on LINE chat history how to spy on LINE chat history
how to spy on LINE chat history
CatherineRai
 
how to spy on LINE messages
how to spy on LINE messageshow to spy on LINE messages
how to spy on LINE messages
CatherineRai
 
DS_Final_Project
DS_Final_ProjectDS_Final_Project
DS_Final_Project
星星 孫
 
Library management in Data structure
Library management in Data structure Library management in Data structure
Library management in Data structure
harshil1902
 
Garrage management system
Garrage management system Garrage management system
Garrage management system
Prateek Pandey
 
Simple Calendar Application using C
Simple Calendar Application using CSimple Calendar Application using C
Simple Calendar Application using C
codewithc
 
62 how to track someone elses line messages
62 how to track someone elses line messages62 how to track someone elses line messages
62 how to track someone elses line messages
CatherineRai
 
Costume analysis
Costume analysisCostume analysis
Costume analysis
HannahO4997
 
how to spy on husbands line messages
how to spy on husbands line messageshow to spy on husbands line messages
how to spy on husbands line messages
CatherineRai
 
งานนำเสนชุมชน (แก้ไข)
งานนำเสนชุมชน (แก้ไข)งานนำเสนชุมชน (แก้ไข)
งานนำเสนชุมชน (แก้ไข)
Blsaw Wannarat
 
Biochemistry
BiochemistryBiochemistry
Biochemistry
qalikn
 
Algo labpresentation a_group
Algo labpresentation a_groupAlgo labpresentation a_group
Algo labpresentation a_group
Umme habiba
 
how to hack my husbands LINE
how to hack my husbands LINE how to hack my husbands LINE
how to hack my husbands LINE
CatherineRai
 
how to track line chat remotely
how to track line chat remotelyhow to track line chat remotely
how to track line chat remotely
CatherineRai
 
how to spy on LINE chat history
how to spy on LINE chat history how to spy on LINE chat history
how to spy on LINE chat history
CatherineRai
 
how to spy on LINE messages
how to spy on LINE messageshow to spy on LINE messages
how to spy on LINE messages
CatherineRai
 
Ad

Similar to Project of data structure (20)

Stack
StackStack
Stack
Amrutha Rajan
 
04 stacks
04 stacks04 stacks
04 stacks
Rajan Gautam
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
maamir farooq
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
Ahsan Mansiv
 
Stack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparationStack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparation
RAtna29
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptx
SajalFayyaz
 
Stack data structure
Stack data structureStack data structure
Stack data structure
rogineojerio020496
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
AliRaza899305
 
Stacks
StacksStacks
Stacks
Sadaf Ismail
 
STACK1.pptx
STACK1.pptxSTACK1.pptx
STACK1.pptx
MouDhara1
 
Lec 4 Stack of Data Structures & Algorithms
Lec 4 Stack of Data Structures & AlgorithmsLec 4 Stack of Data Structures & Algorithms
Lec 4 Stack of Data Structures & Algorithms
haseebanjum2611
 
6 - STACKS in Data Structure and Algorithm.pptx
6 - STACKS in Data Structure and Algorithm.pptx6 - STACKS in Data Structure and Algorithm.pptx
6 - STACKS in Data Structure and Algorithm.pptx
RahulRaj493025
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
nikshaikh786
 
MO 2020 DS Stacks 1 AB.ppt
MO 2020 DS Stacks 1 AB.pptMO 2020 DS Stacks 1 AB.ppt
MO 2020 DS Stacks 1 AB.ppt
shashankbhadouria4
 
Abscddnddmdkwkkstack implementation.pptx
Abscddnddmdkwkkstack implementation.pptxAbscddnddmdkwkkstack implementation.pptx
Abscddnddmdkwkkstack implementation.pptx
zainshahid3040
 
Stack linked list
Stack linked listStack linked list
Stack linked list
bhargav0077
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
STACKS implimentarions AND stack applications .pptx
STACKS implimentarions AND stack applications .pptxSTACKS implimentarions AND stack applications .pptx
STACKS implimentarions AND stack applications .pptx
Dr. Amna Mohamed
 
Stack
StackStack
Stack
Zaid Shabbir
 
introduction of the Stacks and Queues.pptx
introduction of the  Stacks and Queues.pptxintroduction of the  Stacks and Queues.pptx
introduction of the Stacks and Queues.pptx
kavitashingi123
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
maamir farooq
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
Ahsan Mansiv
 
Stack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparationStack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparation
RAtna29
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptx
SajalFayyaz
 
Lec 4 Stack of Data Structures & Algorithms
Lec 4 Stack of Data Structures & AlgorithmsLec 4 Stack of Data Structures & Algorithms
Lec 4 Stack of Data Structures & Algorithms
haseebanjum2611
 
6 - STACKS in Data Structure and Algorithm.pptx
6 - STACKS in Data Structure and Algorithm.pptx6 - STACKS in Data Structure and Algorithm.pptx
6 - STACKS in Data Structure and Algorithm.pptx
RahulRaj493025
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
nikshaikh786
 
Abscddnddmdkwkkstack implementation.pptx
Abscddnddmdkwkkstack implementation.pptxAbscddnddmdkwkkstack implementation.pptx
Abscddnddmdkwkkstack implementation.pptx
zainshahid3040
 
Stack linked list
Stack linked listStack linked list
Stack linked list
bhargav0077
 
STACKS implimentarions AND stack applications .pptx
STACKS implimentarions AND stack applications .pptxSTACKS implimentarions AND stack applications .pptx
STACKS implimentarions AND stack applications .pptx
Dr. Amna Mohamed
 
introduction of the Stacks and Queues.pptx
introduction of the  Stacks and Queues.pptxintroduction of the  Stacks and Queues.pptx
introduction of the Stacks and Queues.pptx
kavitashingi123
 
Ad

More from Umme habiba (20)

Compiler lab final report writing
Compiler lab final report writingCompiler lab final report writing
Compiler lab final report writing
Umme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
Umme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
Umme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
Umme habiba
 
Accounting adjusting
Accounting adjustingAccounting adjusting
Accounting adjusting
Umme habiba
 
Economic.assignment
Economic.assignmentEconomic.assignment
Economic.assignment
Umme habiba
 
Major economic problems of bangladesh
Major economic problems of bangladeshMajor economic problems of bangladesh
Major economic problems of bangladesh
Umme habiba
 
Overview of various types of operating system
Overview of various types of operating systemOverview of various types of operating system
Overview of various types of operating system
Umme habiba
 
Os lab report(shell coding)
Os lab report(shell coding)Os lab report(shell coding)
Os lab report(shell coding)
Umme habiba
 
Ecommerce(online Shopping)
Ecommerce(online Shopping)Ecommerce(online Shopping)
Ecommerce(online Shopping)
Umme habiba
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.cao
Umme habiba
 
2nd generation of computer
2nd generation of computer2nd generation of computer
2nd generation of computer
Umme habiba
 
Art_of_living assignment
Art_of_living assignmentArt_of_living assignment
Art_of_living assignment
Umme habiba
 
Art_of_living
Art_of_livingArt_of_living
Art_of_living
Umme habiba
 
Informationsecurity
InformationsecurityInformationsecurity
Informationsecurity
Umme habiba
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.Database
Umme habiba
 
WLAN of networking.ppt
WLAN of networking.pptWLAN of networking.ppt
WLAN of networking.ppt
Umme habiba
 
simpson's in numerical method
simpson's in numerical methodsimpson's in numerical method
simpson's in numerical method
Umme habiba
 
Error detection in Data comunication
 Error detection in Data comunication Error detection in Data comunication
Error detection in Data comunication
Umme habiba
 
microsoft word & powerpoint
 microsoft word & powerpoint microsoft word & powerpoint
microsoft word & powerpoint
Umme habiba
 
Compiler lab final report writing
Compiler lab final report writingCompiler lab final report writing
Compiler lab final report writing
Umme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
Umme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
Umme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
Umme habiba
 
Accounting adjusting
Accounting adjustingAccounting adjusting
Accounting adjusting
Umme habiba
 
Economic.assignment
Economic.assignmentEconomic.assignment
Economic.assignment
Umme habiba
 
Major economic problems of bangladesh
Major economic problems of bangladeshMajor economic problems of bangladesh
Major economic problems of bangladesh
Umme habiba
 
Overview of various types of operating system
Overview of various types of operating systemOverview of various types of operating system
Overview of various types of operating system
Umme habiba
 
Os lab report(shell coding)
Os lab report(shell coding)Os lab report(shell coding)
Os lab report(shell coding)
Umme habiba
 
Ecommerce(online Shopping)
Ecommerce(online Shopping)Ecommerce(online Shopping)
Ecommerce(online Shopping)
Umme habiba
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.cao
Umme habiba
 
2nd generation of computer
2nd generation of computer2nd generation of computer
2nd generation of computer
Umme habiba
 
Art_of_living assignment
Art_of_living assignmentArt_of_living assignment
Art_of_living assignment
Umme habiba
 
Informationsecurity
InformationsecurityInformationsecurity
Informationsecurity
Umme habiba
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.Database
Umme habiba
 
WLAN of networking.ppt
WLAN of networking.pptWLAN of networking.ppt
WLAN of networking.ppt
Umme habiba
 
simpson's in numerical method
simpson's in numerical methodsimpson's in numerical method
simpson's in numerical method
Umme habiba
 
Error detection in Data comunication
 Error detection in Data comunication Error detection in Data comunication
Error detection in Data comunication
Umme habiba
 
microsoft word & powerpoint
 microsoft word & powerpoint microsoft word & powerpoint
microsoft word & powerpoint
Umme habiba
 

Recently uploaded (20)

Working with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to ImplementationWorking with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to Implementation
Alabama Transportation Assistance Program
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Journal of Soft Computing in Civil Engineering
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjjseninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
AjijahamadKhaji
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
DED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedungDED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedung
nabilarizqifadhilah1
 
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
PawachMetharattanara
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjjseninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
AjijahamadKhaji
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
DED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedungDED KOMINFO detail engginering design gedung
DED KOMINFO detail engginering design gedung
nabilarizqifadhilah1
 
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
PawachMetharattanara
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 

Project of data structure

  • 5. A stack is a data structure that stores data in such a way that the last piece of data stored, is the first one retrieved. LAST IN FIRST OUT =LIFO To get the bottom plate out, you must first remove all the plates above. Example of stack
  • 6. All these applications follow the LIFO logic. REAL LIFE: Stacks are present everyday life.From the books in a library, to the blank sheets of paper in a printer tray systems are used STACK to complete their acts. #PILES OF BOOKS: A book is added on top of a pile of books, while removing a book from a pile also takes the book on top of a pile in everywhere.
  • 8. #SOURCE CODE: void push(int *top, element item) { /* add an item to the global stack */ if (*top >= MAX_STACK_SIZE-1) { stack_full( ); return; } stack[++*top] = item; } Push element pop(int *top) { /* return the top element from the stack */ if (*top == -1) return stack_empty( ); /* returns and error key */ return stack[(*top)--]; } Pop
  • 10. RLATEDTO COMPUTER SCIENCE: Below are a few applications of stacks in computing. #REVERSING STRING: A simple application of stack is reversing strings. To reverse a string , the characters of string are pushed onto the stack one by one as the string is read from left to right. To reverse the string ‘REVERSE’ the string is read from left to right and its characters are pushed.LIKE:
  • 11. E S R E V E R REVERSE ESREVER String is Reverse String Stack #VISULAZE STAGE:
  • 12. #define MAX 20 int top = -1; char stack[MAX]; char pop(); void push(char); main() { char str[20]; int i; printf(“Enter the string : ” ); gets(str); for(i=0;i<strlen(str);i++) push(str[i]); for(i=0;i<strlen(str);i++) str[i]=pop(); printf(“Reversed string is : “); puts(str); void push(char item){ if(top == (MAX-1)) { printf(“Stack Overflown”); return; } stack[++top] =item; }/*End of push()*/ char pop(){ if(top == -1) { printf(“Stack Underflown”); exit(1); } return stack[top–]; }
  • 14. #Calculator Methodology: Every arithmetic operation in calculator follow the stack postfix notation. * + 9 6 39+6*3 Equation Postfix string Stack
  • 15. Create Stack While(not end of postfix notation){ ch = getch() if(ch is operand) push(ch) else{ operand1 = pop() operand2 = pop() result = operand2 ch operand1 push(result) } } Result = pop()
  • 17. #Function ( recursive ): A very good example of stack is Function. Summation of positive integer can be implemented by recursive function and the functions are stored in a stack to maintain the sequence of summation. When a function is called within a function then the previous function is stored in a stack with it’s local variables. Summation of positive numbers with code example:
  • 18. #include <stdio.h> int sum(int n); int main(){ int num,add; printf("Enter a positive integer:n"); scanf("%d",&num); add=sum(num); printf("sum=%d",add); } int sum(int n){ if(n==0) return n; else return n+sum(n-1); /*self call to function sum() */ } Enter a positive integer: 5 15 Output
  • 19. For better visualization of recursion in this example: sum(5) =5+sum(4) =5+4+sum(3) =5+4+3+sum(2) =5+4+3+2+sum(1) =5+4+3+2+1+sum(0) =5+4+3+2+1+0 =5+4+3+2+1 =5+4+3+3 =5+4+6 =5+10 =15 Sum(1) Sum(2) Sum(3) Sum(4) Sum(5) All functions are pushed in stack
  • 21. Implementation : Palindrome A palindrome is a word, phrase, number, or other sequence of Characters which reads the same backward or forward. Allowances may be made for adjustments to capital letters, punctuation, and word dividers. Suppose : ABCDCBA is a palindrome FGHHGF is a palindrome ASDFASDF is not a palindrome
  • 22. C I V I C C I V I C PUSH POP Stack Stack Palindrome Word After pushing and popping, CIVIC word remain unchanged #VISULAZE STAGE:
  • 23. Source code: char stk[50]; int top=-1; void push(char c){ top++; stk[top]=c; } char pop(){ char c; c=stk[top]; top–; return c; } void main(){ char in[30],b[30]; int i; printf(“nn ENTER UR STRINGt”); gets(in); for(i=0;in[i]!=‘’;i++){ push(in[i]); } i=0; while(top!=-1){ b[i]=pop(); i++; } b[i]=‘’; if(strcmp(in,b)==0){ printf (“n STRING is PALLINDROME”); } else{ printf (“n STRING IS NOT PALLNDROME”); } }
  翻译: