document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class Queue {
  2.  
  3.     private int capacity;
  4.     char queueArr[];
  5.     int front;
  6.     int rear;
  7.     int currentSize = 0;
  8.  
  9.     public Queue(int sizeOfQueue) {
  10.         this.capacity = sizeOfQueue;
  11.         front = 0;
  12.         rear = -1;
  13.         queueArr = new char[this.capacity];
  14.     }
  15.  
  16.     public void enqueue(char data) {
  17.         if (!isFull()){
  18.             rear++;
  19.             if (rear == capacity) {
  20.                 rear = 0;
  21.             }
  22.             queueArr[rear] = data;
  23.             currentSize++;
  24.         }
  25.     }
');