java program : Assume the following method is added to the ArrayStack class. What does this method do? public ArrayStack Undefined() { int j = topOfStack; ArrayStack st1= new ArrayStack(topOfStack + 1); for(int i = 0; i < topOfStack + 1; i++) { st1.theData[j] = theData[i]; j-- ; } return st1;
java program :
Assume the following method is added to the ArrayStack class. What does this method do?
public ArrayStack<E> Undefined()
{
int j = topOfStack;
ArrayStack<E> st1= new ArrayStack<E>(topOfStack + 1);
for(int i = 0; i < topOfStack + 1; i++)
{
st1.theData[j] = theData[i];
j-- ;
}
return st1;
}
-
The method will return a stack containing all the elements of “this” stack in the reverse order.
-
The method will return a stack containing the alternative elements of “this” stack in the original order.
-
The method will return a stack containing all the elements of “this” stack in the original order.
-
The method will return a stack containing the alternative elements of “this” stack in the reverse order.
![Given the following method within the ArrayQueue class, what does it do ?
public int Undefined(E item)
{
int i = front, count = 0;
for ( int j = 0; j< size; j++ )
{
if (! theData[i].equals(item))
count++;
i = (i + 1) % capacity;
}
return count;
}
A) It returns the number of the elements in the queue not equal to the element at the front of the queue and, also item.
B
It returns the number of the elements in the queue not equal to the element at the front of the queue.
It returns the number of elements of the queue not equal to item.
D
It returns the number of occurrences of item in the queue.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9bb37147-55e0-4015-9d10-448ae535614d%2Fc10aceca-e3b4-4a18-a2db-85c5ad010e3c%2Fd3z176c_processed.png&w=3840&q=75)

Step by step
Solved in 2 steps with 1 images









