SlideShare a Scribd company logo
Stack Applications
What is stack ?

 Stack is a special type of data
  structure.
 Compared to a container.
 Last In First Out.
What is push ?
   Inserting a element into stack.
What is stack overflow ?
 Pushing elements when stack is full.
 When top exceeds size of stack .
Algorithm push
Procedure Push (Value)
If TOP is equal to MAX
Output an error that the Stack is full
Else
Add 1 to TOP
Put data in Value into TOP position
End If
End Procedure
What is pop ?
   Removing the top element from the
    stack.
What is stack underflow ?
 Performing pop operation when a
  stack is empty.
 When top equals zero.
Algorithm pop
Procedure Pop
If TOP is equal to Zero then
Stack is empty “Underflow”
Else
Output value from Stack at TOP position
Subtract 1 from TOP
End If
End Procedure
Stack Applications
Applications of stack

 Start up & Shut down.
    Function calling.
 Argument passing in c.
System Startup
Stack Data Structure & It's Application
System Shutdown
Stack Data Structure & It's Application
Function calling
void three()
{
printf("Three startedn");
printf("Three endedn");
}
void two()
{
printf("Two startedn");
three();
printf("Two endedn");
}
void one()
{
printf("One startedn");
two();
printf("One endedn");
}
void main()
{
clrscr();
printf("Main startedn");
one();
printf("Main endedn");
getch();
}
Output

Main started
One started
Two started
Three started
Three ended
Two ended
One ended
Main ended
Argument passing in C
•   Consider the following program :-


# include <stdio.h>
# include <conio.h>
void main()
{
int a=3;
clrscr();
printf(“%d %d%d%d”,a++,++a,++a,a++);
getch();
}


Expected o/p.
3566
 But
o/p is 6 6 5 3

Because the argument are passed from
right to left in a stack and then sent to
printf function.
%d %d   Top
%d %d

 6      Called function ie, printf(…);

        Here the input is taken from stack
 6      So, the data order will be 6 6 5 3.

 5      Therefore the o/p will be 6 6 5 3.

 3
Conclusion
   Stack is one of the efficient way to
    implement discipline to system.
Thank You.
Ad

More Related Content

What's hot (20)

Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
ForwardBlog Enewzletter
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
RacksaviR
 
Binary Search
Binary SearchBinary Search
Binary Search
kunj desai
 
1.4 expression tree
1.4 expression tree  1.4 expression tree
1.4 expression tree
Krish_ver2
 
Stack
StackStack
Stack
Zaid Shabbir
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
gomathi chlm
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
shameen khan
 
Binary Tree in Data Structure
Binary Tree in Data StructureBinary Tree in Data Structure
Binary Tree in Data Structure
Meghaj Mallick
 
Stacks
StacksStacks
Stacks
Malainine Zaid
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
Janki Shah
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ManishPrajapati78
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
 
Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
Jeanie Arnoco
 
Linked list
Linked listLinked list
Linked list
akshat360
 
Linked List
Linked ListLinked List
Linked List
Ashim Lamichhane
 
Queue_Data_Structure.pptx
Queue_Data_Structure.pptxQueue_Data_Structure.pptx
Queue_Data_Structure.pptx
sandeep54552
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
Apurbo Datta
 
stack & queue
stack & queuestack & queue
stack & queue
manju rani
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
RacksaviR
 
1.4 expression tree
1.4 expression tree  1.4 expression tree
1.4 expression tree
Krish_ver2
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
gomathi chlm
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
shameen khan
 
Binary Tree in Data Structure
Binary Tree in Data StructureBinary Tree in Data Structure
Binary Tree in Data Structure
Meghaj Mallick
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
Janki Shah
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ManishPrajapati78
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
 
Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
Jeanie Arnoco
 
Queue_Data_Structure.pptx
Queue_Data_Structure.pptxQueue_Data_Structure.pptx
Queue_Data_Structure.pptx
sandeep54552
 

Viewers also liked (7)

16 combinatroics-2
16 combinatroics-216 combinatroics-2
16 combinatroics-2
Tin học Sức sống
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
Permutation & Combination
Permutation & CombinationPermutation & Combination
Permutation & Combination
Puru Agrawal
 
Permutation and combination
Permutation and combinationPermutation and combination
Permutation and combination
Sadia Zareen
 
Permutations and combinations examples
Permutations and combinations examplesPermutations and combinations examples
Permutations and combinations examples
Leo Crisologo
 
Permutations & Combinations
Permutations & CombinationsPermutations & Combinations
Permutations & Combinations
rfant
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
Permutation & Combination
Permutation & CombinationPermutation & Combination
Permutation & Combination
Puru Agrawal
 
Permutation and combination
Permutation and combinationPermutation and combination
Permutation and combination
Sadia Zareen
 
Permutations and combinations examples
Permutations and combinations examplesPermutations and combinations examples
Permutations and combinations examples
Leo Crisologo
 
Permutations & Combinations
Permutations & CombinationsPermutations & Combinations
Permutations & Combinations
rfant
 
Ad

Similar to Stack Data Structure & It's Application (20)

Stacks
StacksStacks
Stacks
Sadaf Ismail
 
04 stacks
04 stacks04 stacks
04 stacks
Rajan Gautam
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
Stack data structure
Stack data structureStack data structure
Stack data structure
rogineojerio020496
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
nikshaikh786
 
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
 
Stacks
StacksStacks
Stacks
sweta dargad
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
Ahsan Mansiv
 
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxSTACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
KALPANAC20
 
In C++ a function used to put data into a stack is typically called a.docx
In C++ a function used to put data into a stack is typically called a.docxIn C++ a function used to put data into a stack is typically called a.docx
In C++ a function used to put data into a stack is typically called a.docx
tristans3
 
stack (1).pptx
stack (1).pptxstack (1).pptx
stack (1).pptx
CrazyKiller4
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueWhat is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
Balwant Gorad
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
Yogesh Pawar
 
Stack,queue and linked list data structure.pptx
Stack,queue and linked list data structure.pptxStack,queue and linked list data structure.pptx
Stack,queue and linked list data structure.pptx
yukti266975
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
AliRaza899305
 
DS UNIT1_STACKS.pptx
DS UNIT1_STACKS.pptxDS UNIT1_STACKS.pptx
DS UNIT1_STACKS.pptx
VeerannaKotagi1
 
STACK_IN_DATA STRUCTURE AND ALGORITHMS.pptx
STACK_IN_DATA STRUCTURE AND ALGORITHMS.pptxSTACK_IN_DATA STRUCTURE AND ALGORITHMS.pptx
STACK_IN_DATA STRUCTURE AND ALGORITHMS.pptx
bwubca22582
 
week 7,8,10,11 alll files included from .ppt
week 7,8,10,11 alll files included from .pptweek 7,8,10,11 alll files included from .ppt
week 7,8,10,11 alll files included from .ppt
LidetAdmassu
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
JinTaek Seo
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
nikshaikh786
 
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
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
Ahsan Mansiv
 
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxSTACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
KALPANAC20
 
In C++ a function used to put data into a stack is typically called a.docx
In C++ a function used to put data into a stack is typically called a.docxIn C++ a function used to put data into a stack is typically called a.docx
In C++ a function used to put data into a stack is typically called a.docx
tristans3
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueWhat is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
Balwant Gorad
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
Yogesh Pawar
 
Stack,queue and linked list data structure.pptx
Stack,queue and linked list data structure.pptxStack,queue and linked list data structure.pptx
Stack,queue and linked list data structure.pptx
yukti266975
 
STACK_IN_DATA STRUCTURE AND ALGORITHMS.pptx
STACK_IN_DATA STRUCTURE AND ALGORITHMS.pptxSTACK_IN_DATA STRUCTURE AND ALGORITHMS.pptx
STACK_IN_DATA STRUCTURE AND ALGORITHMS.pptx
bwubca22582
 
week 7,8,10,11 alll files included from .ppt
week 7,8,10,11 alll files included from .pptweek 7,8,10,11 alll files included from .ppt
week 7,8,10,11 alll files included from .ppt
LidetAdmassu
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
JinTaek Seo
 
Ad

More from Tech_MX (20)

Uid
UidUid
Uid
Tech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
Tech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
Tech_MX
 
String & its application
String & its applicationString & its application
String & its application
Tech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
Tech_MX
 
Spss
SpssSpss
Spss
Tech_MX
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure
Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
Tech_MX
 
Parsing
ParsingParsing
Parsing
Tech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
Tech_MX
 
More on Lex
More on LexMore on Lex
More on Lex
Tech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
Tech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
Tech_MX
 
Linkers
LinkersLinkers
Linkers
Tech_MX
 
Linear regression
Linear regressionLinear regression
Linear regression
Tech_MX
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
Tech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
Tech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
Tech_MX
 
String & its application
String & its applicationString & its application
String & its application
Tech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
Tech_MX
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure
Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
Tech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
Tech_MX
 
More on Lex
More on LexMore on Lex
More on Lex
Tech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
Tech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
Tech_MX
 
Linear regression
Linear regressionLinear regression
Linear regression
Tech_MX
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
Tech_MX
 

Recently uploaded (20)

Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 

Stack Data Structure & It's Application

  • 2. What is stack ?  Stack is a special type of data structure.  Compared to a container.  Last In First Out.
  • 3. What is push ?  Inserting a element into stack.
  • 4. What is stack overflow ?  Pushing elements when stack is full.  When top exceeds size of stack .
  • 5. Algorithm push Procedure Push (Value) If TOP is equal to MAX Output an error that the Stack is full Else Add 1 to TOP Put data in Value into TOP position End If End Procedure
  • 6. What is pop ?  Removing the top element from the stack.
  • 7. What is stack underflow ?  Performing pop operation when a stack is empty.  When top equals zero.
  • 8. Algorithm pop Procedure Pop If TOP is equal to Zero then Stack is empty “Underflow” Else Output value from Stack at TOP position Subtract 1 from TOP End If End Procedure
  • 10. Applications of stack Start up & Shut down. Function calling. Argument passing in c.
  • 16. void three() { printf("Three startedn"); printf("Three endedn"); } void two() { printf("Two startedn"); three(); printf("Two endedn"); } void one() { printf("One startedn"); two(); printf("One endedn"); } void main() { clrscr(); printf("Main startedn"); one(); printf("Main endedn"); getch(); }
  • 17. Output Main started One started Two started Three started Three ended Two ended One ended Main ended
  • 18. Argument passing in C • Consider the following program :- # include <stdio.h> # include <conio.h> void main() { int a=3; clrscr(); printf(“%d %d%d%d”,a++,++a,++a,a++); getch(); } Expected o/p. 3566
  • 19.  But o/p is 6 6 5 3 Because the argument are passed from right to left in a stack and then sent to printf function.
  • 20. %d %d Top %d %d 6 Called function ie, printf(…); Here the input is taken from stack 6 So, the data order will be 6 6 5 3. 5 Therefore the o/p will be 6 6 5 3. 3
  • 21. Conclusion  Stack is one of the efficient way to implement discipline to system.