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, 22.06.2019 02:10
3. (5 points) describe what would be printed by the code below or what error would occur. const char* cstr = "0123456"; const char* ptr = & cstr[4]; cout < < ptr[-1] < < ptr < < endl; 1 4. (5 points) theseus has been trapped in a maze with a minotaur, which is trying to capture him. each round, theseus and the minotaur move through the maze; theseus towards the exit, and the minotaur towards theseus. theseus can move in any of the four cardinal directions, or he can wait for a round to see how the minotaur moves. write code that creates a data type to represent the possible moves that theseus could make.
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
What is the name of the option in most presentation applications with which you can modify slide elements? 1. the option enables you to modify a slide element in most presentation applications.
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Which excel file extension stores automated steps for repetitive tasks?
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
Mathematics, 09.12.2020 21:10