Introduction to Queue

Introduction to Queue

  • Queue is a list of elements in which an element is inserted at one end and deleted from the other end of the queue.
  • Elements are inserted at the rear end and deleted from the front end.
Various operations implemented on a queue are:
  • Insert
  • Delete
Insert: 
  • It refers to the addition of an item in the queue.
  • Suppose you want to add an item F in the following queue.
  • Since the items are inserted at the rear end, therefore, F is inserted after D.
  • Now F becomes the rear end.
Delete: 
  • It refers to the deletion of an item from the queue. 
  • Since the items are deleted from the front end, therefore, item B is removed from the queue.
  • Now A becomes the front end of the queue.

Implementing a Queue

  • You can implement a queue by using an array or a linked list. 
  • A queue implemented in the form of a linked list is known as a linked queue
  • To keep track of the rear and front positions, you need to declare two variables/pointers, REAR and FRONT.
  • If the queue is empty, REAR and FRONT point to NULL.

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz