Queue structure | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Queue structure

Is it necessary to add elements at the end of the queue? What if I add elements at the beginning and delete from the end ? it's not a queue anymore?

27th Jul 2018, 8:37 AM
Andy Grosu
Andy Grosu - avatar
2 Answers
0
if you add elements at the beginning it is also a FIFO structure
27th Jul 2018, 8:50 AM
Andy Grosu
Andy Grosu - avatar
0
i mean that it depends on how one defines a queue. if you add nodes at the first node and delete them from the end node, this is also a FIFO structure. the difference is that the elements are reversed when one prints them. thx.
27th Jul 2018, 11:15 AM
Andy Grosu
Andy Grosu - avatar