Question: Queue in java Complete the below java program by adding the following methods: class Queue private int front, rear, size; private int arro[]; Queue(ints) {

Queue in java

Queue in java Complete the below java program by adding the following

Complete the below java program by adding the following methods: class Queue private int front, rear, size; private int arro[]; Queue(ints) { front =-1; rear = -1; size = s; arro = new int[size]; } 1. size() prints the number of elements in the queue. (void method) 2. isEmpty) checks if the queue is empty or not. (return type is beglean) 3. iskull!) checks if the queue is full or not. (return type is boolean) 4. front() prints the first element of the queue. (void method) 5. enqueue(int item) checks if the queue is not full then add item on the rear. (void method) 6. dequeuel) checks if the queue is not empty then removes the element on front. (void method) 7. display() prints all elements of the queue 8. split() splits the elements of the queue in two queues and prints the two queues. (void method). Ex: q = 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!