Question: Given the following method within the Queue, what does it do ? public E Undefined() { int i = front; for ( int j =

Given the following method within the Queue, what does it do ?

public E Undefined()

{

int i = front;

for ( int j = 0; j < size - 1; j++ )

{

if (theData[i].equals(theData[(i + 1)%capacity]))

return theData[i];

else

i = (i + 1) % capacity;

}

return null;

}

a.

It returns the value of the element if it equals to the element at the front.

b.

It returns the value of the element if it equals to its next element in the queue.

c.

It returns the value of the element if it equals to the element at rear.

d.

It returns the value of the element if all the elements of the queue are same.

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!