Address
Whiteland, IN 46184

Work Hours
Monday to Friday: 9AM - 5PM
Weekend: 1PM - 3PM

Queue Data Structure

OBJECTIVES

  • Define what a queue is
  • Understand use cases for a queue
  • Implement operations on a queue data structure

What is a Queue?
A queue is a linear data structure that follows a particular order for insertion and deletion. The is referred to as FIFO (First In First Out). The first element added to the stack will be the first element removed from the stack.
How it is used?
The real-world example of a Queue is a “queue” that is when we stand in line, the first person on the line is the first person that leaves the line or the first person that gets attended to. This is the same for computers.
 In programming, queues are used in 

  • Background tasks
  • Uploading resources
  • Printing / Task processing.

BigO of Queues

  • Insertion –   O(1)
  • Removal –   O(1)
  • Searching –   O(N)
  • Access –   O(N)

RECAP

  • Queues are a FIFO data structure, all elements are first in first out.
  • Queues are useful for processing tasks and are foundational for more complex data structures
  • Insertion and Removal can be done in O(1)

 
 
Written by Okocha Ebube

Get our Latest Insights right in your Inbox.

Enter your email address below to subscribe to our weekly newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *