Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Queue {
- private int capacity;
- char queueArr[];
- int front;
- int rear;
- int currentSize = 0;
- public Queue(int sizeOfQueue) {
- this.capacity = sizeOfQueue;
- front = 0;
- rear = -1;
- queueArr = new char[this.capacity];
- }
- public void enqueue(char data) {
- if (!isFull()){
- rear++;
- if (rear == capacity) {
- rear = 0;
- }
- queueArr[rear] = data;
- currentSize++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment