SlideShare una empresa de Scribd logo
1 de 16
UNIT- II
Linear data structure
Stack ADT
• Stack is a linear data structure in which the insertion and
deletion operations are performed at only one end. In a stack,
adding and removing of elements are performed at a single
position which is known as "top“
• In stack, the insertion and deletion operations are performed
based on LIFO (Last In First Out) principle or FILO(First In Last
Out).
Operations
• isFull()
• isEmpty()
• Push(x)
• Pop()
• Peek()
• Size()
• https://towardsdatascience.com/stack-
and-array-implementation-with-python-
and-nodejs-b8b260229e3a
Applications of stack
• used for expression evaluation.
• used to check parenthesis matching in an
expression.
• used for Conversion from one form of
expression to another.
• used for Memory Management.
• used in backtracking problems.
• https://www.youtube.com/watch?v=d_XvFOkQz
5k
Evaluating arithmetic
expressions
• Polish notation(Prefix) +AB
• Reverse polish notation(Postfix ) AB+
• Infix notation A+B
•A+B/*C-
•(A+B)/(C-D)
• +AB-C
•http://www.btechsmartclass.com/da
ta_structures/infix-to-postfix.html
Conversion of infix to postfix
notation
Conversion of infix to postfix
• Place parentheses around every group of operators in the
correct order of evaluation. There should be one set of
parentheses for every operator in the infix expression
• ((A * B) + (C / D))
• For each set of parentheses, move the operator from the
middle to the end preceding the corresponding closing
parenthesis.
• ((A B *) (C D /) +)
• Remove all of the parentheses, resulting in the equivalent
postfix expression.
• A B * C D / +
Evaluating arithmetic
expressions
Input Stack
2 3 4 * + empty Push 2
3 4 * + 2 Push 3
4 * + 3 2 Push 4
* + 4 3 2 Pop 4 and 3, and
perform 4*3 = 12.
Push 12 into the
stack.
+ 12 2 Pop 12 and 2 from
the stack, and
perform 12+2 = 14.
Push 14 into the
stack.
1) Postfix expression: 2 3 4 * +
Input Stack
3 4 * 2 5 * + empty Push 3
4 * 2 5 * + 3 Push 4
*2 5 * + 4 3 Pop 3 and 4 from the stack
and perform 3*4 = 12. Push
12 into the stack.
2 5 * + 12 Push 2
5 * + 2 12 Push 5
*+ 5 2 12 Pop 5 and 2 from the stack
and perform 5*2 = 10. Push
10 into the stack.
+ 10 12 Pop 10 and 12 from the
stack and perform 10+12 =
22. Push 22 into the stack.
2 )Postfix expression: 3 4 * 2 5 * +
Queue ADT
• Queue data structure is a collection of similar data items
in which insertion and deletion operations are performed
based on FIFO principle
Operations
1.enQueue(value) - (To insert an element into the queue)
2.deQueue() - (To delete an element from the queue)
3.display() - (To display the elements of the queue)
4.Queue() – creates a new empty queue
5.isEmpty()-returns a boolean value
6.Length()-returns the number of items currently in the
queue
https://www.geeksforgeeks.org/array-implementation-of-queue-
simple/
Circular queue
• A circular queue is a linear data structure in which the
operations are performed based on FIFO (First In First Out)
principle and the last position is connected back to the first
position to make a circle.
Priority queue
• Every item has a priority associated with it.
• An element with high priority is dequeued before an element
with low priority.
• If two elements have the same priority, they are served
according to their order in the queue.
Types:
1)Bounded priority queue - small limited range of p priorities
over the interval of integers [0 . . . P]
2)Unbounded priority queue - no limit on the range of integer
values
Doubly Ended queue(Deque)
• It allows insertion and removal of elements from
both the ends, i.e , front and back.
Applications of Queue
• In operating systems like Semaphores,FCFS, Buffer for
devices
• CPU task scheduling
• In networks like mail queues, queues in routers/switches
Real time application
• call center phone system to hold the calls

Más contenido relacionado

La actualidad más candente (20)

Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Stack - Data Structure
Stack - Data StructureStack - Data Structure
Stack - Data Structure
 
The Stack And Recursion
The Stack And RecursionThe Stack And Recursion
The Stack And Recursion
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS
 
Sorting
SortingSorting
Sorting
 
Queues
QueuesQueues
Queues
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
 
Queue
QueueQueue
Queue
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)
 
Presentation on queue
Presentation on queuePresentation on queue
Presentation on queue
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Queues in C++
Queues in C++Queues in C++
Queues in C++
 
stack presentation
stack presentationstack presentation
stack presentation
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
Unit II - LINEAR DATA STRUCTURES
Unit II -  LINEAR DATA STRUCTURESUnit II -  LINEAR DATA STRUCTURES
Unit II - LINEAR DATA STRUCTURES
 
stack & queue
stack & queuestack & queue
stack & queue
 
Queues
Queues Queues
Queues
 

Similar a STACK AND QUEUE ADT GUIDE

@Chapter 4 DSA Part II.pptx
@Chapter 4 DSA Part II.pptx@Chapter 4 DSA Part II.pptx
@Chapter 4 DSA Part II.pptxNuraMohamed9
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTSoumen Santra
 
Data Structures by Maneesh Boddu
Data Structures by Maneesh BodduData Structures by Maneesh Boddu
Data Structures by Maneesh Boddumaneesh boddu
 
queueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxqueueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxMeghaKulkarni27
 
Queue ADT for data structure for computer
Queue ADT for data structure for computerQueue ADT for data structure for computer
Queue ADT for data structure for computerabinathsabi
 
Stack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxStack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxchandankumar364348
 
Data Structures and Files
Data Structures and FilesData Structures and Files
Data Structures and FilesKanchanPatil34
 
Ch03_stacks_and_queues.ppt
Ch03_stacks_and_queues.pptCh03_stacks_and_queues.ppt
Ch03_stacks_and_queues.pptOliverKane3
 
CD3291 2.5 stack.pptx
CD3291 2.5 stack.pptxCD3291 2.5 stack.pptx
CD3291 2.5 stack.pptxmareeswari15
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)mailmerk
 

Similar a STACK AND QUEUE ADT GUIDE (20)

9 python data structure-2
9 python data structure-29 python data structure-2
9 python data structure-2
 
@Chapter 4 DSA Part II.pptx
@Chapter 4 DSA Part II.pptx@Chapter 4 DSA Part II.pptx
@Chapter 4 DSA Part II.pptx
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
 
Data Structures by Maneesh Boddu
Data Structures by Maneesh BodduData Structures by Maneesh Boddu
Data Structures by Maneesh Boddu
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Data Structures
Data StructuresData Structures
Data Structures
 
linked list in c++
linked list in c++linked list in c++
linked list in c++
 
queueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxqueueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptx
 
Chapter 4 stack
Chapter 4 stackChapter 4 stack
Chapter 4 stack
 
Queue ADT for data structure for computer
Queue ADT for data structure for computerQueue ADT for data structure for computer
Queue ADT for data structure for computer
 
Stack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxStack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptx
 
Queue
QueueQueue
Queue
 
Data Structures and Files
Data Structures and FilesData Structures and Files
Data Structures and Files
 
Ch03_stacks_and_queues.ppt
Ch03_stacks_and_queues.pptCh03_stacks_and_queues.ppt
Ch03_stacks_and_queues.ppt
 
STACK1.pptx
STACK1.pptxSTACK1.pptx
STACK1.pptx
 
Unit 4 queue
Unit   4 queueUnit   4 queue
Unit 4 queue
 
CD3291 2.5 stack.pptx
CD3291 2.5 stack.pptxCD3291 2.5 stack.pptx
CD3291 2.5 stack.pptx
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)
 

Más de LavanyaJ28

Cs1301 syllabus
Cs1301  syllabusCs1301  syllabus
Cs1301 syllabusLavanyaJ28
 
Ds important questions
Ds important questionsDs important questions
Ds important questionsLavanyaJ28
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using pythonLavanyaJ28
 
Searching,sorting
Searching,sortingSearching,sorting
Searching,sortingLavanyaJ28
 
Heap types & Trees
Heap types & TreesHeap types & Trees
Heap types & TreesLavanyaJ28
 
Unit ii linear data structures
Unit ii linear data structures Unit ii linear data structures
Unit ii linear data structures LavanyaJ28
 
Unit ii linear data structures
Unit ii linear data structures Unit ii linear data structures
Unit ii linear data structures LavanyaJ28
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack LavanyaJ28
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked listLavanyaJ28
 
Unit 1 Basic concepts to DS
Unit 1 Basic concepts to DSUnit 1 Basic concepts to DS
Unit 1 Basic concepts to DSLavanyaJ28
 
Unit 1 array based implementation
Unit 1  array based implementationUnit 1  array based implementation
Unit 1 array based implementationLavanyaJ28
 
Unit 1 polynomial manipulation
Unit 1   polynomial manipulationUnit 1   polynomial manipulation
Unit 1 polynomial manipulationLavanyaJ28
 
Unit 1 abstract data types
Unit 1 abstract data typesUnit 1 abstract data types
Unit 1 abstract data typesLavanyaJ28
 

Más de LavanyaJ28 (16)

Cs1301 syllabus
Cs1301  syllabusCs1301  syllabus
Cs1301 syllabus
 
Ds important questions
Ds important questionsDs important questions
Ds important questions
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using python
 
Searching,sorting
Searching,sortingSearching,sorting
Searching,sorting
 
Hashing
HashingHashing
Hashing
 
Graphs
GraphsGraphs
Graphs
 
Unit 3 trees
Unit 3   treesUnit 3   trees
Unit 3 trees
 
Heap types & Trees
Heap types & TreesHeap types & Trees
Heap types & Trees
 
Unit ii linear data structures
Unit ii linear data structures Unit ii linear data structures
Unit ii linear data structures
 
Unit ii linear data structures
Unit ii linear data structures Unit ii linear data structures
Unit ii linear data structures
 
Unit 2 application of stack
Unit 2  application of stack Unit 2  application of stack
Unit 2 application of stack
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
 
Unit 1 Basic concepts to DS
Unit 1 Basic concepts to DSUnit 1 Basic concepts to DS
Unit 1 Basic concepts to DS
 
Unit 1 array based implementation
Unit 1  array based implementationUnit 1  array based implementation
Unit 1 array based implementation
 
Unit 1 polynomial manipulation
Unit 1   polynomial manipulationUnit 1   polynomial manipulation
Unit 1 polynomial manipulation
 
Unit 1 abstract data types
Unit 1 abstract data typesUnit 1 abstract data types
Unit 1 abstract data types
 

Último

Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 

Último (20)

Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 

STACK AND QUEUE ADT GUIDE

  • 2. Stack ADT • Stack is a linear data structure in which the insertion and deletion operations are performed at only one end. In a stack, adding and removing of elements are performed at a single position which is known as "top“ • In stack, the insertion and deletion operations are performed based on LIFO (Last In First Out) principle or FILO(First In Last Out).
  • 3. Operations • isFull() • isEmpty() • Push(x) • Pop() • Peek() • Size() • https://towardsdatascience.com/stack- and-array-implementation-with-python- and-nodejs-b8b260229e3a
  • 4.
  • 5. Applications of stack • used for expression evaluation. • used to check parenthesis matching in an expression. • used for Conversion from one form of expression to another. • used for Memory Management. • used in backtracking problems. • https://www.youtube.com/watch?v=d_XvFOkQz 5k
  • 6. Evaluating arithmetic expressions • Polish notation(Prefix) +AB • Reverse polish notation(Postfix ) AB+ • Infix notation A+B •A+B/*C- •(A+B)/(C-D) • +AB-C •http://www.btechsmartclass.com/da ta_structures/infix-to-postfix.html
  • 7. Conversion of infix to postfix notation
  • 8. Conversion of infix to postfix • Place parentheses around every group of operators in the correct order of evaluation. There should be one set of parentheses for every operator in the infix expression • ((A * B) + (C / D)) • For each set of parentheses, move the operator from the middle to the end preceding the corresponding closing parenthesis. • ((A B *) (C D /) +) • Remove all of the parentheses, resulting in the equivalent postfix expression. • A B * C D / +
  • 9. Evaluating arithmetic expressions Input Stack 2 3 4 * + empty Push 2 3 4 * + 2 Push 3 4 * + 3 2 Push 4 * + 4 3 2 Pop 4 and 3, and perform 4*3 = 12. Push 12 into the stack. + 12 2 Pop 12 and 2 from the stack, and perform 12+2 = 14. Push 14 into the stack. 1) Postfix expression: 2 3 4 * +
  • 10. Input Stack 3 4 * 2 5 * + empty Push 3 4 * 2 5 * + 3 Push 4 *2 5 * + 4 3 Pop 3 and 4 from the stack and perform 3*4 = 12. Push 12 into the stack. 2 5 * + 12 Push 2 5 * + 2 12 Push 5 *+ 5 2 12 Pop 5 and 2 from the stack and perform 5*2 = 10. Push 10 into the stack. + 10 12 Pop 10 and 12 from the stack and perform 10+12 = 22. Push 22 into the stack. 2 )Postfix expression: 3 4 * 2 5 * +
  • 11. Queue ADT • Queue data structure is a collection of similar data items in which insertion and deletion operations are performed based on FIFO principle
  • 12. Operations 1.enQueue(value) - (To insert an element into the queue) 2.deQueue() - (To delete an element from the queue) 3.display() - (To display the elements of the queue) 4.Queue() – creates a new empty queue 5.isEmpty()-returns a boolean value 6.Length()-returns the number of items currently in the queue https://www.geeksforgeeks.org/array-implementation-of-queue- simple/
  • 13. Circular queue • A circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle.
  • 14. Priority queue • Every item has a priority associated with it. • An element with high priority is dequeued before an element with low priority. • If two elements have the same priority, they are served according to their order in the queue. Types: 1)Bounded priority queue - small limited range of p priorities over the interval of integers [0 . . . P] 2)Unbounded priority queue - no limit on the range of integer values
  • 15. Doubly Ended queue(Deque) • It allows insertion and removal of elements from both the ends, i.e , front and back.
  • 16. Applications of Queue • In operating systems like Semaphores,FCFS, Buffer for devices • CPU task scheduling • In networks like mail queues, queues in routers/switches Real time application • call center phone system to hold the calls