SlideShare a Scribd company logo
1 of 1
Download to read offline
Why does the stack use a FILO (first in last out) scheme?
Solution
When a program starts executing, a certain contiguous section of memory is set aside for the
program called the stack.
A stack is a limited access data structure - elements can be added and removed from the stack
only at the top. push adds an item to the top of the stack, pop removes the item from the top. A
helpful analogy is to think of a stack of books; you can remove only the top book, also you can
add a new book on the top.
Hence when the elements are pushed onto the stack using push operations, the first element
pushes will be at the bottom of stack and the last element pushed in will be at top of stack.
Therefore when pop operation is executed , top element ( last element pushed in )of stack is
popped out first and hence first element pushed in popped out last.
Thereby Stack operates in LIFO (last in first out ) or FILO ( First In Last Out) Scheme

More Related Content

Similar to Why does the stack use a FILO (first in last out) schemeSolutio.pdf

Similar to Why does the stack use a FILO (first in last out) schemeSolutio.pdf (20)

Stack & queue
Stack & queueStack & queue
Stack & queue
 
Data structure.pdf
Data structure.pdfData structure.pdf
Data structure.pdf
 
Stacks Data structure.pptx
Stacks Data structure.pptxStacks Data structure.pptx
Stacks Data structure.pptx
 
Stacks
StacksStacks
Stacks
 
Data structure Stack
Data structure StackData structure Stack
Data structure Stack
 
stack 1.pdf
stack 1.pdfstack 1.pdf
stack 1.pdf
 
STACK ( LIFO STRUCTURE) - Data Structure
STACK ( LIFO STRUCTURE) - Data StructureSTACK ( LIFO STRUCTURE) - Data Structure
STACK ( LIFO STRUCTURE) - Data Structure
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
Stack
StackStack
Stack
 
Stack PPT.pptx
Stack PPT.pptxStack PPT.pptx
Stack PPT.pptx
 
Stack
StackStack
Stack
 
Stack and its operations
Stack and its operationsStack and its operations
Stack and its operations
 
Lect 15-16 Zaheer Abbas
Lect 15-16 Zaheer  AbbasLect 15-16 Zaheer  Abbas
Lect 15-16 Zaheer Abbas
 
Stack and its operation implemented with array new - Copy.pptx
Stack and its operation implemented with array new - Copy.pptxStack and its operation implemented with array new - Copy.pptx
Stack and its operation implemented with array new - Copy.pptx
 
Module 2 ppt.pptx
Module 2 ppt.pptxModule 2 ppt.pptx
Module 2 ppt.pptx
 
stack coding.pptx
stack coding.pptxstack coding.pptx
stack coding.pptx
 
Chapter 5-stack.pptx
Chapter 5-stack.pptxChapter 5-stack.pptx
Chapter 5-stack.pptx
 
Operation on stack
Operation on stackOperation on stack
Operation on stack
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data Structure
 
Stack
StackStack
Stack
 

More from kesav24

If 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdf
If 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdfIf 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdf
If 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdfkesav24
 
In the equation below f is a frequency, and L is a length. What are .pdf
In the equation below f is a frequency, and L is a length. What are .pdfIn the equation below f is a frequency, and L is a length. What are .pdf
In the equation below f is a frequency, and L is a length. What are .pdfkesav24
 
how are the axial and appendicular skeletons attachedSolutionA.pdf
how are the axial and appendicular skeletons attachedSolutionA.pdfhow are the axial and appendicular skeletons attachedSolutionA.pdf
how are the axial and appendicular skeletons attachedSolutionA.pdfkesav24
 
How many base pairs of DNA represent the haploid human genome How m.pdf
How many base pairs of DNA represent the haploid human genome How m.pdfHow many base pairs of DNA represent the haploid human genome How m.pdf
How many base pairs of DNA represent the haploid human genome How m.pdfkesav24
 
From a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdf
From a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdfFrom a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdf
From a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdfkesav24
 
Find and classify all singularities of the gamma and riemann zeta fu.pdf
Find and classify all singularities of the gamma and riemann zeta fu.pdfFind and classify all singularities of the gamma and riemann zeta fu.pdf
Find and classify all singularities of the gamma and riemann zeta fu.pdfkesav24
 
Discuss the two group classifications that exist in Windows Server 2.pdf
Discuss the two group classifications that exist in Windows Server 2.pdfDiscuss the two group classifications that exist in Windows Server 2.pdf
Discuss the two group classifications that exist in Windows Server 2.pdfkesav24
 
Describe the differences between allelic heterogeneity and locus het.pdf
Describe the differences between allelic heterogeneity and locus het.pdfDescribe the differences between allelic heterogeneity and locus het.pdf
Describe the differences between allelic heterogeneity and locus het.pdfkesav24
 
Decision Tree Table for choosing present and future value equations. .pdf
Decision Tree Table for choosing present and future value equations. .pdfDecision Tree Table for choosing present and future value equations. .pdf
Decision Tree Table for choosing present and future value equations. .pdfkesav24
 
Consider this experiment I have 20-sided die where each face has a .pdf
Consider this experiment I have 20-sided die where each face has a .pdfConsider this experiment I have 20-sided die where each face has a .pdf
Consider this experiment I have 20-sided die where each face has a .pdfkesav24
 
congenital malformations. why do you think they occurSolution.pdf
congenital malformations. why do you think they occurSolution.pdfcongenital malformations. why do you think they occurSolution.pdf
congenital malformations. why do you think they occurSolution.pdfkesav24
 
Considering the cultures used to inoculate each medium in this labora.pdf
Considering the cultures used to inoculate each medium in this labora.pdfConsidering the cultures used to inoculate each medium in this labora.pdf
Considering the cultures used to inoculate each medium in this labora.pdfkesav24
 
Are the transfermations linear Are they an isomorphism WhySol.pdf
Are the transfermations linear Are they an isomorphism WhySol.pdfAre the transfermations linear Are they an isomorphism WhySol.pdf
Are the transfermations linear Are they an isomorphism WhySol.pdfkesav24
 
bessavillabessavillabessavillabessavillaSoluti.pdf
bessavillabessavillabessavillabessavillaSoluti.pdfbessavillabessavillabessavillabessavillaSoluti.pdf
bessavillabessavillabessavillabessavillaSoluti.pdfkesav24
 
ciny Univer Laboratory es and crossing over assortment of independent.pdf
ciny Univer Laboratory es and crossing over assortment of independent.pdfciny Univer Laboratory es and crossing over assortment of independent.pdf
ciny Univer Laboratory es and crossing over assortment of independent.pdfkesav24
 
A population of rabbits quadruples every 2 years. If the initial num.pdf
A population of rabbits quadruples every 2 years. If the initial num.pdfA population of rabbits quadruples every 2 years. If the initial num.pdf
A population of rabbits quadruples every 2 years. If the initial num.pdfkesav24
 
7. describe and correct the error. Describe and correct the error. .pdf
7. describe and correct the error. Describe and correct the error.  .pdf7. describe and correct the error. Describe and correct the error.  .pdf
7. describe and correct the error. Describe and correct the error. .pdfkesav24
 
3. Where would you expect to find fenestrated capillaries (More tha.pdf
3. Where would you expect to find fenestrated capillaries (More tha.pdf3. Where would you expect to find fenestrated capillaries (More tha.pdf
3. Where would you expect to find fenestrated capillaries (More tha.pdfkesav24
 
Assembly LanguageReverse an array.Use a loop with indirect or i.pdf
Assembly LanguageReverse an array.Use a loop with indirect or i.pdfAssembly LanguageReverse an array.Use a loop with indirect or i.pdf
Assembly LanguageReverse an array.Use a loop with indirect or i.pdfkesav24
 
wo alternative investment proposals are under consideration for a va.pdf
wo alternative investment proposals are under consideration for a va.pdfwo alternative investment proposals are under consideration for a va.pdf
wo alternative investment proposals are under consideration for a va.pdfkesav24
 

More from kesav24 (20)

If 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdf
If 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdfIf 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdf
If 0.150 mL of 10^-7.5 dilution yielded an average of 256 coloniesp.pdf
 
In the equation below f is a frequency, and L is a length. What are .pdf
In the equation below f is a frequency, and L is a length. What are .pdfIn the equation below f is a frequency, and L is a length. What are .pdf
In the equation below f is a frequency, and L is a length. What are .pdf
 
how are the axial and appendicular skeletons attachedSolutionA.pdf
how are the axial and appendicular skeletons attachedSolutionA.pdfhow are the axial and appendicular skeletons attachedSolutionA.pdf
how are the axial and appendicular skeletons attachedSolutionA.pdf
 
How many base pairs of DNA represent the haploid human genome How m.pdf
How many base pairs of DNA represent the haploid human genome How m.pdfHow many base pairs of DNA represent the haploid human genome How m.pdf
How many base pairs of DNA represent the haploid human genome How m.pdf
 
From a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdf
From a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdfFrom a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdf
From a group of cards that has 13 hearts, 6 spades, 2 diamonds and 4.pdf
 
Find and classify all singularities of the gamma and riemann zeta fu.pdf
Find and classify all singularities of the gamma and riemann zeta fu.pdfFind and classify all singularities of the gamma and riemann zeta fu.pdf
Find and classify all singularities of the gamma and riemann zeta fu.pdf
 
Discuss the two group classifications that exist in Windows Server 2.pdf
Discuss the two group classifications that exist in Windows Server 2.pdfDiscuss the two group classifications that exist in Windows Server 2.pdf
Discuss the two group classifications that exist in Windows Server 2.pdf
 
Describe the differences between allelic heterogeneity and locus het.pdf
Describe the differences between allelic heterogeneity and locus het.pdfDescribe the differences between allelic heterogeneity and locus het.pdf
Describe the differences between allelic heterogeneity and locus het.pdf
 
Decision Tree Table for choosing present and future value equations. .pdf
Decision Tree Table for choosing present and future value equations. .pdfDecision Tree Table for choosing present and future value equations. .pdf
Decision Tree Table for choosing present and future value equations. .pdf
 
Consider this experiment I have 20-sided die where each face has a .pdf
Consider this experiment I have 20-sided die where each face has a .pdfConsider this experiment I have 20-sided die where each face has a .pdf
Consider this experiment I have 20-sided die where each face has a .pdf
 
congenital malformations. why do you think they occurSolution.pdf
congenital malformations. why do you think they occurSolution.pdfcongenital malformations. why do you think they occurSolution.pdf
congenital malformations. why do you think they occurSolution.pdf
 
Considering the cultures used to inoculate each medium in this labora.pdf
Considering the cultures used to inoculate each medium in this labora.pdfConsidering the cultures used to inoculate each medium in this labora.pdf
Considering the cultures used to inoculate each medium in this labora.pdf
 
Are the transfermations linear Are they an isomorphism WhySol.pdf
Are the transfermations linear Are they an isomorphism WhySol.pdfAre the transfermations linear Are they an isomorphism WhySol.pdf
Are the transfermations linear Are they an isomorphism WhySol.pdf
 
bessavillabessavillabessavillabessavillaSoluti.pdf
bessavillabessavillabessavillabessavillaSoluti.pdfbessavillabessavillabessavillabessavillaSoluti.pdf
bessavillabessavillabessavillabessavillaSoluti.pdf
 
ciny Univer Laboratory es and crossing over assortment of independent.pdf
ciny Univer Laboratory es and crossing over assortment of independent.pdfciny Univer Laboratory es and crossing over assortment of independent.pdf
ciny Univer Laboratory es and crossing over assortment of independent.pdf
 
A population of rabbits quadruples every 2 years. If the initial num.pdf
A population of rabbits quadruples every 2 years. If the initial num.pdfA population of rabbits quadruples every 2 years. If the initial num.pdf
A population of rabbits quadruples every 2 years. If the initial num.pdf
 
7. describe and correct the error. Describe and correct the error. .pdf
7. describe and correct the error. Describe and correct the error.  .pdf7. describe and correct the error. Describe and correct the error.  .pdf
7. describe and correct the error. Describe and correct the error. .pdf
 
3. Where would you expect to find fenestrated capillaries (More tha.pdf
3. Where would you expect to find fenestrated capillaries (More tha.pdf3. Where would you expect to find fenestrated capillaries (More tha.pdf
3. Where would you expect to find fenestrated capillaries (More tha.pdf
 
Assembly LanguageReverse an array.Use a loop with indirect or i.pdf
Assembly LanguageReverse an array.Use a loop with indirect or i.pdfAssembly LanguageReverse an array.Use a loop with indirect or i.pdf
Assembly LanguageReverse an array.Use a loop with indirect or i.pdf
 
wo alternative investment proposals are under consideration for a va.pdf
wo alternative investment proposals are under consideration for a va.pdfwo alternative investment proposals are under consideration for a va.pdf
wo alternative investment proposals are under consideration for a va.pdf
 

Recently uploaded

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 

Recently uploaded (20)

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 

Why does the stack use a FILO (first in last out) schemeSolutio.pdf

  • 1. Why does the stack use a FILO (first in last out) scheme? Solution When a program starts executing, a certain contiguous section of memory is set aside for the program called the stack. A stack is a limited access data structure - elements can be added and removed from the stack only at the top. push adds an item to the top of the stack, pop removes the item from the top. A helpful analogy is to think of a stack of books; you can remove only the top book, also you can add a new book on the top. Hence when the elements are pushed onto the stack using push operations, the first element pushes will be at the bottom of stack and the last element pushed in will be at top of stack. Therefore when pop operation is executed , top element ( last element pushed in )of stack is popped out first and hence first element pushed in popped out last. Thereby Stack operates in LIFO (last in first out ) or FILO ( First In Last Out) Scheme