Applications of priority queue, circular queue, deque | Queue data structure applications

05 min read

 

Queue is an abstract data structure that follows the FIFO (First In First Out) principle where an element that is added first will be deleted first. Also, there are linear data structures as the elements are linearly arranged. The following are the various applications of queue.

Some of the real world applications of queues are

  • Cashier line in any store.
  • People in an escalator.
  • Check in and check out at any book store.

 

applications of queue

 

Some of the applications of queues related to computer science are

  • Data getting transferred between the IO Buffers (Input Output Buffers).
  • CPU scheduling and Disk scheduling.
  • Managing shared resources between various processes.
  • Job scheduling algorithms.
  • Round robin scheduling.
  • Recognizing a palindrome.

 

Applications of circular queue

 

  • Traffic light functioning is the best example for circular queues. The colors in the traffic light follow a circular pattern.
  • In page replacement algorithms, a circular list of pages is maintained and when a page needs to be replaced, the page in the front of the queue will be chosen.

 

Applications of deque

 

  • Pallindrome checker.
  • A-steal job scheduling algorithm

          - The A-steal algorithm implements task scheduling for multiple processors (multiprocessor scheduling).

          - The processor gets the first element from the double ended queue.

          - When one of the processors completes execution of its own thread, it can steal a thread from other processors.

          - It gets the last element from the deque of another processor and executes it.

  • Undo-redo operations in software applications.

 

Applications of Priority Queue

 

  • Prim's algorithm implementation can be done using priority queues.
  • Dijkstra's shortest path algorithm implementation can be done using priority queues.
  • A* Search algorithm implementation can be done using priority queues.
  • Priority queues are used to sort heaps.
  • Priority queues are used in operating system for load balancing and interrupt handling.
  • Priority queues are used in huffman codes for data compression.
  • In traffic light, depending upon the traffic, the colors will be given priority.
POST A NEW COMMENT
     
  • Input (stdin)

    Output (stdout)


    Input (stdin)

    Your Output (stdout)

    Expected Output

    Compiler Message

    Input (stdin)

    2    3

    Your Output (stdout)

    5

    Expected Output

    5

    Compiler Message

    5

    Error