Create a linked list that is a palindrome

Assignment Help JAVA Programming
Reference no: EM131587361

Using a Linked List structure, determine whether a linked list contains a Palindrome in integers. For example, the following is a Palindrome:
0-> 1 -> 2 -> 1 -> 0
To solve this problem, following these steps:
1.) reverse the linked list
2.) compare the reversed list to the original list
3.) if they're the same, you have a Palindrome.

Create the following methods in a helper class. From the tester/driver class, call isPalindrome(aLL) from main.
Create the linked list by hard coding values in the linked list. For example:
LinkedList<String> goodTest = new LinkedList<String>();
goodTest.addLast("0");
goodTest.addLast("1");
goodTest.addLast("2");
goodTest.addLast("1");
goodTest.addLast("0")
boolean isPalindrome(LinkedList aLL) ~ given a linked list, will return whether the linked list is a Palindrome.
LinkedList reverseAndClone(LinkedList aLL) ~ given a linked list, will return the reversed linked list.
boolean isEqual(LinkedList one, LinkedList two) ~ given the 2 linked lists, will return whether they are both the same.

To test the program, in main method:

1. create a linked list that is a Palindrome, and call the isPalindrome method, passing it a linkedList. Test to ensure it returns True.

2. create a linked list that is NOT a Palindrome, and call the isPalindrome method passing it a linkedList. Test to ensure it returns a False.

Reference no: EM131587361

Questions Cloud

Your total implied and actual transaction cost in dollars : what is your total implied and actual transaction cost in dollars?
What are the breakeven points of her alternative strategy : Linda is also considering an alternative lower-cost strategy. What are the breakeven points of her alternative strategy?
Define correlation is not causation : Describe what revisions you might need to make to your essay to ensure that your argument is logical
Create a system flowchart of the existing system : Discount Tool's revenue process is initiated when a customer places an order either online, Create a system flowchart of the existing system
Create a linked list that is a palindrome : Create a linked list that is a Palindrome, and call the isPalindrome method, passing it a linkedList. Test to ensure it returns True.
Weighted average cost of capital for skye corporation : What is the weighted average cost of capital for SKYE Corporation given the following information?
Specific example of technology : Take a specific example of technology and explain how these two have been or might be combined.
Define identify each sentence as passive or active : Identify each sentence as passive or active. Explain why they are passive or active
The stages of organizational growth presents : Discuss which of the first four (4) stages of organizational growth presents the greatest single challenge and why.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write an application that uses string method region

Write an application that uses String method region - Matches to compare two strings input by the user. The application should input the number of characters to be compared and the starting index of the comparison.

  Programming exercises

Modify the rain program in Listing 10.7 so that it does the calculations using pointers instead of subscripts. (You still have to declare and initialize the array.)

  Create and code a program that uses three parallel numeric

Create and code a program that uses three parallel numeric arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays.

  Write program that prompt the user to input a decimal number

Write a program that prompts the user to input a decimal number and outputs the number rounded to the nearest integer. Submit your compiled Java code for this assignment, compress the .java file into a single .zip file.

  Calculate a customer''s charges and total bill

A state sales tax is applied to the sum of all charges except for the federal gasoline tax

  Write a java application titled mystringtest

Write a Java application titled MyStringTest that creates an instance of the String class and initializes this instance with a String literal.

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Java program to compute invoice for client

You need a java program to compute the invoice for client and then print out invoice to the screen. The consulting rate is $200 per hour.

  Calculate the additional amount of sales

The application will now compare the total annual compensation of at least two salespersons. It will calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners

  Write the classic arcade game of breakout

For each instance variable in your program, explain why you chose to make it an instance variable rather than a local variable - How did you test whether the game would end correctly in this second case? Did you make any changes to the code when test..

  Design debug and test a java program that estimates safety

CSIT811 Assignment. OBJECTIVE - Design, debug and test a Java program that estimates safety of industrial blasts and displays reports

  Create a program that develops an amortization schedule

Your project as a programming consultant is to create a program that develops an amortization schedule. Your program should be written as a Java applet.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd