Queues and Stacks: FIFO and FILO Data Structures, Slides of Data Structures and Algorithms

An introduction to queues and stacks, two fundamental data structures in computer science. Queues follow the first in first out (fifo) principle, while stacks follow the first in last out (filo) principle. The basic functions of queues and stacks, their applications, and different ways to implement them, specifically using arrays and linked lists.

Typology: Slides

2012/2013

Uploaded on 04/30/2013

patel
patel 🇮🇳

3.8

(15)

80 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Queues and Stacks
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Queues and Stacks: FIFO and FILO Data Structures and more Slides Data Structures and Algorithms in PDF only on Docsity!

Queues and Stacks

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)

Queues

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

Queues

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

Queue

  • Linked List representation:

Queue

  • Linked List representation after one dequeue:

Stacks

  • Here is a stack after a series of pushes

Stacks

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

Stack

  • Linked List implementation:

Stack

  • Linked List representation after popping