Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Why do living creatures die? Can it be proved that they are reborn?

Answered: 1 week ago