Queue is a special type of Linear data structure, which holds elements before processing and process elements in a FIFO (first-in-first-out) manner.
Queue is an ordered list in which insertions are done at one end(rear) and deletion are done at other and(front). The first element to be inserted is the first one to be deleted.
Basic Operations in Queue:
Queue must have as least following two functions:
- enQueue(obj) – insert element to the queue in the rear
- deQueue() – remove and return the recent item from the front
A good example of a Queue is that people standing in a railway or movie reservation counter. Queue promotes first come first serve policy.
You May Also Like:
Which data type would you choose for storing currency values like Trading Price in Java?
How would you print a given currency value for Indian Locale (INR Currency)?
Which classes in java are immutable ?
How would you round a double value to certain decimal Precision and Scale ?
What is BlockingQueue? How can we implement Producer and Consumer problem using Blocking Queue?
How to get number of available processors in Java ?
That’s all about Queue Data Structure
If you have any feedback or suggestion please feel free to drop in below comment box.