mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 21:44:07 +08:00
Update Queues.java
This commit is contained in:
@ -1,23 +1,32 @@
|
|||||||
/**
|
/**
|
||||||
* This implements Queues by using the class Queue.
|
* This implements Queues by using the class Queue.
|
||||||
*
|
* <p>
|
||||||
* A queue data structure functions the same as a real world queue.
|
* A queue data structure functions the same as a real world queue.
|
||||||
* The elements that are added first are the first to be removed.
|
* The elements that are added first are the first to be removed.
|
||||||
* New elements are added to the back/rear of the queue.
|
* New elements are added to the back/rear of the queue.
|
||||||
*
|
*
|
||||||
* @author Unknown
|
* @author Unknown
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Queue {
|
class Queue {
|
||||||
/** Max size of the queue */
|
/**
|
||||||
|
* Max size of the queue
|
||||||
|
*/
|
||||||
private int maxSize;
|
private int maxSize;
|
||||||
/** The array representing the queue */
|
/**
|
||||||
|
* The array representing the queue
|
||||||
|
*/
|
||||||
private int[] queueArray;
|
private int[] queueArray;
|
||||||
/** Front of the queue */
|
/**
|
||||||
|
* Front of the queue
|
||||||
|
*/
|
||||||
private int front;
|
private int front;
|
||||||
/** Rear of the queue */
|
/**
|
||||||
|
* Rear of the queue
|
||||||
|
*/
|
||||||
private int rear;
|
private int rear;
|
||||||
/** How many items are in the queue */
|
/**
|
||||||
|
* How many items are in the queue
|
||||||
|
*/
|
||||||
private int nItems;
|
private int nItems;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +127,6 @@ class Queue{
|
|||||||
* This class is the example for the Queue class
|
* This class is the example for the Queue class
|
||||||
*
|
*
|
||||||
* @author Unknown
|
* @author Unknown
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Queues {
|
public class Queues {
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user