SlideShare a Scribd company logo
Stack and Queue
• Introduction, Representation, Operations &
Applications
• Presented by [Your Name]
Stack - Introduction
• A stack is a linear data structure that follows
the LIFO (Last In First Out) principle.
• Real-life Example: Stack of plates
•
A stack is a collection of elements with two principal operations: push and pop. It follows the LIFO
principle, where the last element added is the first to be removed.
Stack - Representation
• Can be represented using:
• - Arrays
• - Linked List
• Top of stack points to the most recently added
element.
•
Stacks can be implemented using arrays or linked lists. The 'top' pointer keeps track of the last inserted
element.
Stack - Operations
• 1. push(element): Add element to top
• 2. pop(): Remove top element
• 3. peek(): View top element
• 4. isEmpty(): Check if stack is empty
Applications of Stack
• - Expression Evaluation (Postfix/Infix)
• - Undo operations in text editors
• - Recursive Function Calls
• - Backtracking Algorithms
•
Used in expression parsing, recursive function calls, undo mechanisms, and backtracking algorithms.
Queue - Introduction
• A queue is a linear data structure that follows
the FIFO (First In First Out) principle.
• Real-life Example: Queue at a ticket counter
Queue - Representation
• Can be represented using:
• - Arrays
• - Linked Lists
• Maintains front and rear pointers
•
Queues use two pointers: 'front' and 'rear' for tracking the first and last elements. Implemented using
arrays or linked lists.
Queue - Operations
• 1. enqueue(element): Add to rear
• 2. dequeue(): Remove from front
• 3. peek(): View front element
• 4. isEmpty(): Check if queue is empty
Types of Queue
• - Simple Queue
• - Circular Queue
• - Priority Queue
• - Double-Ended Queue (Deque)
•
1. Simple Queue: FIFO structure
2. Circular Queue: Efficient space usage
3. Priority Queue: Based on priority
4. Deque: Insert/delete from both ends.
Applications of Queue
• - CPU & Disk Scheduling
• - Print Spooling
• - Handling Asynchronous Data
• - Call Center Systems
•
Used in scheduling (CPU, disk), print jobs, asynchronous data, and systems like call centers.
Thank You!
• Any questions?
Stack - Java Pseudocode
• class Stack {
• int[] stack = new int[100];
• int top = -1;
• void push(int x) {
• stack[++top] = x;
• }
• int pop() {
• return stack[top--];
• }
• int peek() {
• return stack[top];
• }
Queue - Java Pseudocode
• class Queue {
• int[] queue = new int[100];
• int front = 0, rear = -1;
• void enqueue(int x) {
• queue[++rear] = x;
• }
• int dequeue() {
• return queue[front++];
• }
• int peek() {
• return queue[front];
• }
Stack - Explanation
• A stack is a collection of elements with two
principal operations: push (to insert an
element) and pop (to remove the top
element). It operates on the LIFO principle,
meaning the last element added is the first to
be removed.
Stack - Representation Explanation
• Stacks can be implemented using arrays or
linked lists. In an array-based implementation,
a single variable 'top' is used to track the last
inserted element. In a linked list, each node
points to the next, and the top points to the
last inserted node.
Stack - Applications Explanation
• Stacks are used in many areas like expression
parsing, function call management in
recursion, undo features in applications, and
backtracking algorithms such as maze solving.
Queue - Representation
Explanation
• Queues are implemented using arrays or
linked lists. It uses two pointers: front (points
to the first element) and rear (points to the
last element). This setup helps manage
insertion and deletion from opposite ends
efficiently.
Types of Queue - Explanation
• 1. Simple Queue: FIFO structure.
• 2. Circular Queue: Connects end to front for
efficient space use.
• 3. Priority Queue: Elements are processed
based on priority.
• 4. Deque: Double-ended queue allowing
insertion/deletion from both ends.
Queue - Applications Explanation
• Queues are used in scheduling algorithms
(CPU, disk), managing print jobs,
asynchronous data transfer, and in real-world
scenarios like call centers or waiting lines
where order must be preserved.

More Related Content

PPT
The Queue in Data structure and algorithm
PPTX
Queue types of queue and algorithms and queue
PPTX
Understanding the Concepts and Applications of Stack and Queue
PPTX
queue.pptx
PPTX
Queues
PDF
9f556226-babd-4276-b964-371c6a5a77b9.pdf
PPTX
Stack and Queue.pptx
The Queue in Data structure and algorithm
Queue types of queue and algorithms and queue
Understanding the Concepts and Applications of Stack and Queue
queue.pptx
Queues
9f556226-babd-4276-b964-371c6a5a77b9.pdf
Stack and Queue.pptx

Similar to Stack_and_Queue_Presentation_Final (1).pptx (20)

PPTX
stack.pptx
PPTX
DS10-QUEUE0000000000000000000000000000000000000.pptx
PPT
Data Structures
PPTX
Queue Data Structure
PPT
Data Structures 2
PPTX
Stack in Sata Structure
PPTX
PPTX
VCE Unit 03vv.pptx
PPTX
Ist year Msc,2nd sem module1
PPTX
DS UNIT2QUEUES.pptx
PPTX
GROUP2.pptxfdfffffffffffffffffffffffffffffffffffffffffff
PPT
Queue AS an ADT (Abstract Data Type)
PPT
Data Structures 3
PPTX
Data Structure Stack operation in python
PPTX
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
PPT
Difference between stack and queue
PPTX
STACK AND QUEUES APPLICATIONS, INFIX TO POST FIX
PPTX
Bca ii dfs u-2 linklist,stack,queue
PPTX
stack and types of stack with algorithms and stack
PDF
Data structure.pdf
stack.pptx
DS10-QUEUE0000000000000000000000000000000000000.pptx
Data Structures
Queue Data Structure
Data Structures 2
Stack in Sata Structure
VCE Unit 03vv.pptx
Ist year Msc,2nd sem module1
DS UNIT2QUEUES.pptx
GROUP2.pptxfdfffffffffffffffffffffffffffffffffffffffffff
Queue AS an ADT (Abstract Data Type)
Data Structures 3
Data Structure Stack operation in python
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
Difference between stack and queue
STACK AND QUEUES APPLICATIONS, INFIX TO POST FIX
Bca ii dfs u-2 linklist,stack,queue
stack and types of stack with algorithms and stack
Data structure.pdf
Ad

Recently uploaded (20)

PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PDF
Lecture1 pattern recognition............
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
IB Computer Science - Internal Assessment.pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PDF
Business Analytics and business intelligence.pdf
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Clinical guidelines as a resource for EBP(1).pdf
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
oil_refinery_comprehensive_20250804084928 (1).pptx
Reliability_Chapter_ presentation 1221.5784
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Business Acumen Training GuidePresentation.pptx
Lecture1 pattern recognition............
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
IB Computer Science - Internal Assessment.pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Business Analytics and business intelligence.pdf
IBA_Chapter_11_Slides_Final_Accessible.pptx
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Ad

Stack_and_Queue_Presentation_Final (1).pptx

  • 1. Stack and Queue • Introduction, Representation, Operations & Applications • Presented by [Your Name]
  • 2. Stack - Introduction • A stack is a linear data structure that follows the LIFO (Last In First Out) principle. • Real-life Example: Stack of plates • A stack is a collection of elements with two principal operations: push and pop. It follows the LIFO principle, where the last element added is the first to be removed.
  • 3. Stack - Representation • Can be represented using: • - Arrays • - Linked List • Top of stack points to the most recently added element. • Stacks can be implemented using arrays or linked lists. The 'top' pointer keeps track of the last inserted element.
  • 4. Stack - Operations • 1. push(element): Add element to top • 2. pop(): Remove top element • 3. peek(): View top element • 4. isEmpty(): Check if stack is empty
  • 5. Applications of Stack • - Expression Evaluation (Postfix/Infix) • - Undo operations in text editors • - Recursive Function Calls • - Backtracking Algorithms • Used in expression parsing, recursive function calls, undo mechanisms, and backtracking algorithms.
  • 6. Queue - Introduction • A queue is a linear data structure that follows the FIFO (First In First Out) principle. • Real-life Example: Queue at a ticket counter
  • 7. Queue - Representation • Can be represented using: • - Arrays • - Linked Lists • Maintains front and rear pointers • Queues use two pointers: 'front' and 'rear' for tracking the first and last elements. Implemented using arrays or linked lists.
  • 8. Queue - Operations • 1. enqueue(element): Add to rear • 2. dequeue(): Remove from front • 3. peek(): View front element • 4. isEmpty(): Check if queue is empty
  • 9. Types of Queue • - Simple Queue • - Circular Queue • - Priority Queue • - Double-Ended Queue (Deque) • 1. Simple Queue: FIFO structure 2. Circular Queue: Efficient space usage 3. Priority Queue: Based on priority 4. Deque: Insert/delete from both ends.
  • 10. Applications of Queue • - CPU & Disk Scheduling • - Print Spooling • - Handling Asynchronous Data • - Call Center Systems • Used in scheduling (CPU, disk), print jobs, asynchronous data, and systems like call centers.
  • 11. Thank You! • Any questions?
  • 12. Stack - Java Pseudocode • class Stack { • int[] stack = new int[100]; • int top = -1; • void push(int x) { • stack[++top] = x; • } • int pop() { • return stack[top--]; • } • int peek() { • return stack[top]; • }
  • 13. Queue - Java Pseudocode • class Queue { • int[] queue = new int[100]; • int front = 0, rear = -1; • void enqueue(int x) { • queue[++rear] = x; • } • int dequeue() { • return queue[front++]; • } • int peek() { • return queue[front]; • }
  • 14. Stack - Explanation • A stack is a collection of elements with two principal operations: push (to insert an element) and pop (to remove the top element). It operates on the LIFO principle, meaning the last element added is the first to be removed.
  • 15. Stack - Representation Explanation • Stacks can be implemented using arrays or linked lists. In an array-based implementation, a single variable 'top' is used to track the last inserted element. In a linked list, each node points to the next, and the top points to the last inserted node.
  • 16. Stack - Applications Explanation • Stacks are used in many areas like expression parsing, function call management in recursion, undo features in applications, and backtracking algorithms such as maze solving.
  • 17. Queue - Representation Explanation • Queues are implemented using arrays or linked lists. It uses two pointers: front (points to the first element) and rear (points to the last element). This setup helps manage insertion and deletion from opposite ends efficiently.
  • 18. Types of Queue - Explanation • 1. Simple Queue: FIFO structure. • 2. Circular Queue: Connects end to front for efficient space use. • 3. Priority Queue: Elements are processed based on priority. • 4. Deque: Double-ended queue allowing insertion/deletion from both ends.
  • 19. Queue - Applications Explanation • Queues are used in scheduling algorithms (CPU, disk), managing print jobs, asynchronous data transfer, and in real-world scenarios like call centers or waiting lines where order must be preserved.