DEV Community

Mohammad Nikkhah
Mohammad Nikkhah

Posted on • Updated on

Queue (data structure)

Hello friends, I am Mohammad. This is the first post on this website
in this post we learn How it works queue list in data structure

What is a queue : queue A list of items Similar to a stack list,A kind of simplified array,
But We can apply limited operators in the queue list

  • for Example We have a queue list below
[13,16,8,6]
Enter fullscreen mode Exit fullscreen mode
  • When we add a value to this list The addition is done from the beginning of the list.
  • For example, if we add a value of 9 to the list, this value will be added to the list first
[9,13,16,8,6]
Enter fullscreen mode Exit fullscreen mode
  • The act of adding is called : enqueue
  • For example, if we delete a value, it will be removed from the bottom of the list.
[9,13,16,8]
Enter fullscreen mode Exit fullscreen mode
  • The delete operation is called : dequeue

The most important difference between Queue and stack

In queue, adding a value is always at the top of the list
In queue, deleting a value is always from the bottom of the list
This is also called FIFO First In First Out.

thank you

Top comments (2)

Collapse
 
senaps profile image
Maysam Senaps

shouldn't it at least be in data structures and not algorithms?(the tag which you have used)

Collapse
 
nikkhahmohammad profile image
Mohammad Nikkhah

tank you