SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Objectives ,[object Object],[object Object],[object Object],[object Object]
[object Object],Stacks 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
[object Object],[object Object],[object Object],[object Object],[object Object],Defining a Stack
[object Object],[object Object],[object Object],Identifying the Operations on Stacks ,[object Object],Empty Stack 1 Push an  Element 1
[object Object],Identifying the Operations on Stacks (Contd.) 1 Push an  Element 2 2 Push an  Element 3 3
[object Object],Identifying the Operations on Stacks (Contd.) 1 POP an  Element  3 2 3 POP an  Element  2
[object Object],Just a minute ,[object Object],[object Object]
[object Object],Just a minute ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Implementing a Stack Using an Array
[object Object],Implementing a Stack Using an Array (Contd.) top =  –   1  PUSH an element 3 Stack 2 1 0 4 3 Initially:
Implementing a Stack Using an Array (Contd.) 10 top =  –   1  Stack 2 1 0 4 3 PUSH an element 3
Implementing a Stack Using an Array (Contd.) 10 top = 0  Stack 2 1 0 4 3 top = 0  PUSH an element 3
Implementing a Stack Using an Array (Contd.) 10 top = 0  10 Stack 2 1 0 4 3 3 Item pushed PUSH an element 3
Implementing a Stack Using an Array (Contd.) 10 top = 0  10 Stack 2 1 0 4 3 3 PUSH an element 8
Implementing a Stack Using an Array (Contd.) 10 top = 0  10 Stack 2 1 0 4 3 3 top = 1  PUSH an element 8
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 top = 1  8 Item pushed PUSH an element 8
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 top = 1  8 PUSH an element 5
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 top = 1  8 top = 2 PUSH an element 5
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 top = 2 5 Item pushed PUSH an element 5
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 top = 2  5 PUSH an element 1
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 top = 2  5 top = 3 PUSH an element 1
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 top = 3 1 Item pushed PUSH an element 1
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 top = 3 1 PUSH an element  9
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 top = 3 1 top = 4 PUSH an element  9
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 top = 4 9 Item pushed PUSH an element  9
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 top = 4 9 PUSH an element  2
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 top = 4 9 top = 5 PUSH an element  2
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 9 top = 5 Stack overflow PUSH an element  2
Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 9 ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Implementing a Stack Using an Array (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],Just a minute ,[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],Applications of Stacks
[object Object],[object Object],Implementing Function Calls
Implementing Function Calls (Contd.) Assuming these instructions at the given locations in the memory.  1100 1101 1103 1120 1121 1122 1140 1141 1102 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The execution starts from function F1 1100 1101 1103 1120 1121 1122 1140 1141 1102 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1100 1101 1103 1120 1121 1122 1140 1141 1102 Implementing Function Calls (Contd.)
x = 5 1100 1101 1103 1120 1121 1122 1140 1141 1102 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
x = 5 Address and the local variable of F1   1100 1101 1103 1120 1121 1122 1140 1141 1102 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1103, x = 5
x = 10 1100 1101 1103 1120 1121 1122 1140 1141 1102 x = 5 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1103, x = 5
1122, x = 10 Address and the local variable of F2  1100 1101 1103 1120 1121 1122 1140 1141 1102 x = 10 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1103, x = 5
x = 20 Address and the local variable of F2  1100 1101 1103 1120 1121 1122 1140 1141 1102 x = 10 1122, x = 10 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1103, x = 5
1100 1101 1103 1120 1121 1122 1140 1141 1102 20 x = 20 x = 10 1122, x = 10 1122, x = 10 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1103, x = 5
1100 1101 1103 1120 1121 1122 1140 1141 1102 20 10 x = 5 1103, x = 5 x = 10 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1103, x = 5
1100 1101 1103 1120 1121 1122 1140 1141 1102 20 10 5 x = 5 Implementing Function Calls (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],Maintaining the UNDO list for an Application
[object Object],[object Object],[object Object],[object Object],Checking the Nesting of Parentheses in an Expression
[object Object],[object Object],[object Object],Implementing Stacks
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],{ {(a + b)  ×  (c + d) ]} Implementing Stacks (Contd.)
[object Object],[object Object],[object Object],[object Object],[object Object],{ ( {(a + b)  ×  (c + d) ]} Implementing Stacks (Contd.)
[object Object],[object Object],[object Object],{ ( ) ( Brackets Matched {(a + b)  ×  (c + d) ]} Implementing Stacks (Contd.)
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],{ ( {(a + b)  ×  (c + d) ]} Implementing Stacks (Contd.)
[object Object],[object Object],[object Object],{ ( ) ( Brackets Matched {(a + b)  ×  (c + d) ]} Implementing Stacks (Contd.)
[object Object],[object Object],[object Object],{ ] { Brackets Do Not Match The Expression is INVALID {(a + b)  ×  (c + d) ]} Implementing Stacks (Contd.)
Algorithm for Balanced Symbol Checking ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Evaluating Expressions ,[object Object],[object Object],[object Object],[object Object],[object Object]
Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Clips basics how to make expert system in clips | facts adding | rules makin...
Clips basics  how to make expert system in clips | facts adding | rules makin...Clips basics  how to make expert system in clips | facts adding | rules makin...
Clips basics how to make expert system in clips | facts adding | rules makin...NaumanMalik30
 
Understanding Lemon Generated Parser Final
Understanding Lemon Generated Parser FinalUnderstanding Lemon Generated Parser Final
Understanding Lemon Generated Parser Finalvivekanandan r
 
Event Stream Processing with Multiple Threads
Event Stream Processing with Multiple ThreadsEvent Stream Processing with Multiple Threads
Event Stream Processing with Multiple ThreadsSylvain Hallé
 
The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88Mahmoud Samir Fayed
 
Understanding Lemon Generated Parser
Understanding Lemon Generated ParserUnderstanding Lemon Generated Parser
Understanding Lemon Generated Parservivekanandan r
 
Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11Stefano Leli
 
The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189Mahmoud Samir Fayed
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlowBayu Aldi Yansyah
 
Python Programming: Data Structure
Python Programming: Data StructurePython Programming: Data Structure
Python Programming: Data StructureChan Shik Lim
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88Mahmoud Samir Fayed
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)gekiaruj
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиMaxim Kulsha
 
Data Science for Folks Without (or With!) a Ph.D.
Data Science for Folks Without (or With!) a Ph.D.Data Science for Folks Without (or With!) a Ph.D.
Data Science for Folks Without (or With!) a Ph.D.Douglas Starnes
 
TCO in Python via bytecode manipulation.
TCO in Python via bytecode manipulation.TCO in Python via bytecode manipulation.
TCO in Python via bytecode manipulation.lnikolaeva
 
The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189Mahmoud Samir Fayed
 

Was ist angesagt? (20)

Clips basics how to make expert system in clips | facts adding | rules makin...
Clips basics  how to make expert system in clips | facts adding | rules makin...Clips basics  how to make expert system in clips | facts adding | rules makin...
Clips basics how to make expert system in clips | facts adding | rules makin...
 
Understanding Lemon Generated Parser Final
Understanding Lemon Generated Parser FinalUnderstanding Lemon Generated Parser Final
Understanding Lemon Generated Parser Final
 
Event Stream Processing with Multiple Threads
Event Stream Processing with Multiple ThreadsEvent Stream Processing with Multiple Threads
Event Stream Processing with Multiple Threads
 
The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88
 
Understanding Lemon Generated Parser
Understanding Lemon Generated ParserUnderstanding Lemon Generated Parser
Understanding Lemon Generated Parser
 
Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11
 
The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlow
 
Python Programming: Data Structure
Python Programming: Data StructurePython Programming: Data Structure
Python Programming: Data Structure
 
Process management
Process managementProcess management
Process management
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88
 
Knight's Tour
Knight's TourKnight's Tour
Knight's Tour
 
Slides
SlidesSlides
Slides
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачи
 
Python_ 3 CheatSheet
Python_ 3 CheatSheetPython_ 3 CheatSheet
Python_ 3 CheatSheet
 
Haskell 101
Haskell 101Haskell 101
Haskell 101
 
Data Science for Folks Without (or With!) a Ph.D.
Data Science for Folks Without (or With!) a Ph.D.Data Science for Folks Without (or With!) a Ph.D.
Data Science for Folks Without (or With!) a Ph.D.
 
TCO in Python via bytecode manipulation.
TCO in Python via bytecode manipulation.TCO in Python via bytecode manipulation.
TCO in Python via bytecode manipulation.
 
The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189
 

Ähnlich wie Stacks

Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacksmaamir farooq
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-listpinakspatel
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manualnikshaikh786
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arraystameemyousaf
 
Introduction to functions
Introduction to functionsIntroduction to functions
Introduction to functionsElkin Guillen
 
My lecture stack_queue_operation
My lecture stack_queue_operationMy lecture stack_queue_operation
My lecture stack_queue_operationSenthil Kumar
 
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...Paulo Miguel Almeida
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7Kumar
 
Stack linked list
Stack linked listStack linked list
Stack linked listbhargav0077
 

Ähnlich wie Stacks (20)

U3.stack queue
U3.stack queueU3.stack queue
U3.stack queue
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
Stack
StackStack
Stack
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
 
stack-Intro.pptx
stack-Intro.pptxstack-Intro.pptx
stack-Intro.pptx
 
Note introductions of functions
Note introductions of functionsNote introductions of functions
Note introductions of functions
 
Introduction to functions
Introduction to functionsIntroduction to functions
Introduction to functions
 
My lecture stack_queue_operation
My lecture stack_queue_operationMy lecture stack_queue_operation
My lecture stack_queue_operation
 
Stacks, Queues, Deques
Stacks, Queues, DequesStacks, Queues, Deques
Stacks, Queues, Deques
 
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
 
Lect-28-Stack-Queue.ppt
Lect-28-Stack-Queue.pptLect-28-Stack-Queue.ppt
Lect-28-Stack-Queue.ppt
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
Stack linked list
Stack linked listStack linked list
Stack linked list
 
Lecture2
Lecture2Lecture2
Lecture2
 
DS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptxDS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptx
 
Stacks queues
Stacks queuesStacks queues
Stacks queues
 

Kürzlich hochgeladen

ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 

Kürzlich hochgeladen (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 

Stacks

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Implementing a Stack Using an Array (Contd.) 10 top = – 1 Stack 2 1 0 4 3 PUSH an element 3
  • 12. Implementing a Stack Using an Array (Contd.) 10 top = 0 Stack 2 1 0 4 3 top = 0 PUSH an element 3
  • 13. Implementing a Stack Using an Array (Contd.) 10 top = 0 10 Stack 2 1 0 4 3 3 Item pushed PUSH an element 3
  • 14. Implementing a Stack Using an Array (Contd.) 10 top = 0 10 Stack 2 1 0 4 3 3 PUSH an element 8
  • 15. Implementing a Stack Using an Array (Contd.) 10 top = 0 10 Stack 2 1 0 4 3 3 top = 1 PUSH an element 8
  • 16. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 top = 1 8 Item pushed PUSH an element 8
  • 17. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 top = 1 8 PUSH an element 5
  • 18. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 top = 1 8 top = 2 PUSH an element 5
  • 19. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 top = 2 5 Item pushed PUSH an element 5
  • 20. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 top = 2 5 PUSH an element 1
  • 21. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 top = 2 5 top = 3 PUSH an element 1
  • 22. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 top = 3 1 Item pushed PUSH an element 1
  • 23. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 top = 3 1 PUSH an element 9
  • 24. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 top = 3 1 top = 4 PUSH an element 9
  • 25. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 top = 4 9 Item pushed PUSH an element 9
  • 26. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 top = 4 9 PUSH an element 2
  • 27. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 top = 4 9 top = 5 PUSH an element 2
  • 28. Implementing a Stack Using an Array (Contd.) 10 10 Stack 2 1 0 4 3 3 8 5 1 9 top = 5 Stack overflow PUSH an element 2
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.

Hinweis der Redaktion

  1. To start the session, you need to get a set of playing cards in the class. Follow the instructions as given below to begin the game of Rummy. 1. The game begins by dealing a fixed number of cards to all players. The remaining cards are placed face down to form a “stock” pile. 2. There is also a face-up pile called the “discard” pile. 3. Initially, the discard pile contains only one card which is obtained by picking the topmost card from the stock pile. 4. Each player can draw either the topmost card of the stock pile or the topmost card on the discard pile to make a valid sequence in his/her hand. 5. After this, the player must discard one card on top of the discard pile. 6. The next player, can then draw either the topmost card of the draw pile or the topmost card of the discard pile. 7. Therefore, if a player has to draw a card from the discard pile, he/she can draw only the topmost card of the discard pile. 8. Similarly, when a player has to discard a card, he/she must discard it on the top of the discard pile. 9. The discard pile can therefore be considered a Last-In-First-Out list. 10. The last card placed on top of the discard pile is the first one to be drawn. 11. To represent and manipulate this kind of a discard pile in a computer program, you would like to use a list that: a. Contains the details of all the cards in the discard pile. b. Implements insertion and deletion of card details in such a way that the last inserted card is the first one to be removed. This kind of a list can be implemented by using a stack. Ask students to define a stack? Ask them to refer to the game and come up with some characteristics of a stack. Then come to next slide and give them the definition of stacks.
  2. You can give some more explanation of stacks by with the help of the following example. 1. A stack is like an empty box containing books, which is just wide enough to hold the books in one pile. 2. The books can be placed as well as removed only from the top of the box. 3. The book most recently put in the box is the first one to be taken out. 4. The book at the bottom is the first one to be put inside the box and the last one to be taken out.
  3. In this slide you need to show the calculation to determine the sum of an arithmetic progression for bubble sort algorithm. Refer to student guide.
  4. In this slide you need to show the calculation to determine the sum of an arithmetic progression for bubble sort algorithm. Refer to student guide.
  5. Tell students that stacks can be implemented using both arrays and Linked List. The slides to explain the implementation of stacks using an array are given.
  6. Make this session an interactive one by asking students to write an algorithm to implement POP operation using an array. Let students first try to write the algorithm. Then you can explain the algorithm given in the student guide. In addition, also explain the exception conditions that is encountered while popping an element from the stack, using an array.
  7. In this slide you need to show the calculation to determine the sum of an arithmetic progression for bubble sort algorithm. Refer to student guide.
  8. In this section, you need to discuss the applications of Stacks. In addition, to the given applications, you can discuss some real life applications also. For example, ask students to notice the operations in their Mobile phones. When you go to the Menu  log  Recent calls  Missed calls. On the missed call page, you will be able to view all the missed call number. To back to the main page, you need to press the back option and it will take you page, you last visited.
  9. In this section, you need to discuss the applications of Stacks. In addition, to the given applications, you can discuss some real life applications also. For example, ask students to notice the operations in their Mobile phones. When you go to the Menu  log  Recent calls  Missed calls. On the missed call page, you will be able to view all the missed call number. To back to the main page, you need to press the back option and it will take you page, you last visited.
  10. Explain this concept to students by further telling them that the changes are internally stored in the stack data structure inside the computer. The last change made is the first one to be reverted.
  11. In this slide, ask students to relate to the example they have learnt in the beginning of the session.
  12. This is one of the applications where stack is used. You need to run through the slides and then ask students to write an algorithm to check the correctness of the nested parenthesis. The algorithm will be: Scan the expression. Push the opening bracket into the stack. If a closing bracket is encountered, check if the closing bracket is same as the opening bracket. If this condition holds true, POP the corresponding opening bracket from the stack. If the condition is false, the expression is not a valid expression.
  13. In this slide, ask students to relate to the example they have learnt in the beginning of the session.