subject

Write a class named palindrome. java and write a method ispalindrome that takes an intqueue as a parameter and that returns whether or not the numbers in the queue represent a palindrome (true if they do, false otherwise). a sequence of numbers is considered a palindrome if it is the same in reverse order. for example, suppose a queue called q stores this sequence of values:
front [3, 8, 17, 9, 17, 8, 3] back
then the following call:
ispalindrome(q) should return true because this sequence is the same in reverse order. if the list had instead stored these values:
front [3, 8, 17, 9, 4, 17, 8, 3] back
the call on ispalindrome would instead return false because this sequence is not the same in reverse order (the 9 and 4 in the middle don't match).
the empty queue should be considered a palindrome. you may not make any assumptions about how many elements are in the queue and your method must restore the queue so that it stores the same sequence of values after the call as it did before. the method header is specified as follows:
public static boolean ispalindrome(intqueue q)
public class intqueue{
integer[] arr;
int numofelements=0;
int front=0;
int rear=-1;
public intqueue(int cap);
public void enqueue(integer data);
public integer dequeue();
public boolean isfull();
public boolean isempty();
}
methods document:
public class intstack{
integer[] arr;
int index=0;
public intstack(int cap);
public void push(integer data);
public integer pop();
public integer top();
public boolean isfull();
public boolean isempty();
}
are the available methods, and we do not have size() or length() which is how i have done these types of problems before.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe what
Answers: 1
You know the right answer?
Write a class named palindrome. java and write a method ispalindrome that takes an intqueue as a par...
Questions
question
English, 15.04.2021 21:20
question
Mathematics, 15.04.2021 21:20
question
Mathematics, 15.04.2021 21:20
question
English, 15.04.2021 21:20
question
Spanish, 15.04.2021 21:20
Questions on the website: 13722362