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, 02.02.2019 19:55
You should try to photograph people on bright sunny days because the light will be best a) true b) false
Answers: 1
question
Computers and Technology, 30.01.2019 05:10
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
question
Computers and Technology, 26.01.2019 22:48
Anetwork security application that prevents access between a private and trusted network and other untrusted networks
Answers: 1
question
Computers and Technology, 25.01.2019 18:35
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a.edit the sizes and other characteristics of photos that have been inserted. b.take a screenshot of an image and copy it to the clipboard for pasting. c.search for drawings or other images from a library of prepared pictures. d.make illustrations using lines and shapes that are easy to manipulate.
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, 24.11.2017 11:50
Questions on the website: 6713914