Queues and Stacks - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Queues and Stacks

Description:

Queues and Stacks Ryan Morris Queues Queues are very simple FIFO (First In First Out) Data Types. Queues have two basic functions: Enqueue (insert object into queue ... – PowerPoint PPT presentation

Number of Views:140
Avg rating:3.0/5.0
Slides: 15
Provided by: csSjsuEdu4
Category:
Tags: queues | stacks

less

Transcript and Presenter's Notes

Title: Queues and Stacks


1
Queues and Stacks
  • Ryan Morris

2
Queues
  • Queues are very simple FIFO (First In First Out)
    Data Types.
  • Queues have two basic functions
  • Enqueue (insert object into queue)
  • Dequeue (remove object from queue)

3
Queues
  • Enqueue simply inserts an object into the back of
    the queue. When objects are inserted they are
    placed in the back, unless the queue is empty
    then the back and the front elements are the same.

4
Queues
  • Dequeue simply reverses the process by removing
    the front object (object inserted first) from the
    queue.

5
Queues
  • Applications of queues
  • Printer queues
  • Socket queues
  • File server queues
  • Any real life line (first come first serve)

6
Queues
  • Queues can be implemented with arrays or linked
    lists.

7
Queue
  • Linked List representation

8
Queue
  • Linked List representation after one dequeue

9
Stacks
  • Stacks are slightly more complicated than queues
    for they are FILO (First In Last Out) data
    structures. Stacks generally have two main
    functions push, which inserts an object into the
    stack, and pop, which removes the top (or last
    pushed) object from the stack.

10
Stacks
  • Here is a stack after a series of pushes

11
Stacks
  • When popped the C would come first then the B
    then the A.

12
Stacks
  • Applications of stacks include
  • Balancing Symbols (such as parenthesis)
  • Infix to Prefix notation conversion
  • Postfix expression evaluation

13
Stack
  • Linked List implementation

14
Stack
  • Linked List representation after popping
Write a Comment
User Comments (0)
About PowerShow.com