Data Structures Queue by using Java

Assoc. Prof. Leon Abdillah

Data Structures Queue by using Java

Leon Andretti Abdillah

Data structures queue works based on the first in first out (FIFO) logic. In a FIFO data structure, the first element added to the queue will be the first one to be removed.

—A queue is a FIFO sequence. Addition takes place only at the tail, and removal takes place only at the head.
Data structures queue works with these methods:
  1. —add(x): add an item at the tail
  2. —poll: remove the item at the head
  3. —peek: return the item at the head (without removing it)
  4. —size: return the number of items in the queue
  5. —isEmpty: return whether the queue has no items

 

References

Abdillah, L. A. (2013). Algorithms & Programming. Available: http://blog.binadarma.ac.id/mleonaa/teaching/programming/algorithm-and-programming-2/

Abdillah, L. A. (2014). Data Structures & Algorithms. Available: http://blog.binadarma.ac.id/mleonaa/teaching/programming/data-structures/

Sedgewick, R., & Wayne, K. (2012). Stacks and Queues. Introduction to Programming in Java, from http://introcs.cs.princeton.edu/java/43stack/

Toal, R. Data Structures. Queues, from http://cs.lmu.edu/~ray/notes/queues/

Leave a Reply

Your email address will not be published. Required fields are marked *