Using a linked list structure determine whether a linked


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 driver class, and call them from main:

Boolean isPalindrome(LinkedListNode head) ~ given the starting node of a linked list, will return whether the linked list is a Palindrome.

LinkedListNode reverseAndClone(LinkedListNode node) ~ given the starting node of a linked list, will return the starting node of the reversed linked list.

Boolean isEqual(LinkedListNode one, LinkedListNode two) ~ given the starting node of 2 linked lists, will return whether they are both the same.

Define 2 global linkedList variables that can be accessed from anywhere, one for origLinkedList and the other for reversedLinkedList.

To test the program, in main method:

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

2. Create a linked list that is NOT a Palindrome, and ensure the call to isPalindrome returns a False.

Solution Preview :

Prepared by a verified Expert
Business Economics: Using a linked list structure determine whether a linked
Reference No:- TGS02252948

Now Priced at $10 (50% Discount)

Recommended (96%)

Rated (4.8/5)