Create a linked list that is a palindrome

Assignment Help Data Structure & Algorithms
Reference no: EM132080134

You need the java code only please...

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.

Reference no: EM132080134

Questions Cloud

Write a java prohram to implement a method : Write a java prohram to Implement a method inPlaceInsertionSort() that takes an array of Clocks as an input.
Determining the price elasticity of demand : The demand curve for a product is given by QXd = 1,200 - 3PX - 0.1PZ where Pz = $300.
Cover the details of the design : Teesside University - A new product design has been recently completed. As a design engineer responsible for the design, you are required to deliver a report
Problem regarding the cost-benefit analysis : a) Compare the real worth, rather than the market values, of various goods and services. b) Compare the relative desirability of alternative distributions.
Create a linked list that is a palindrome : Create a linked list that is a Palindrome, and call the isPalindrome method. Test to ensure it returns True.
Demand and supply curves for a good : With this type of externality, in the absence of government intervention, the market equilibrium quantity produced will be (Greather/less) than the socially
Write a program that will convert distance measurements : Write a C++ program that will convert distance measurements from miles to kilometers.
Devise a scoring system for each objective : ENGINEERING DESIGN - DESIGN REPORT - EVALUATION - THE WEIGHTED OBJECTIVE METHOD - Teesside University - Calculate scores and weighted scores for each car
Create a list and simply implement enqueue and dequeue : Create a Queue. Fill the first list with numbers consecutively numbered from 2 to n where n is entered by the user .

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  How many codewords are there in an even weight code

How many codewords are there in an even-weight code of length n? - Find C⊥ for the even-weight code C of length n.

  Find the optimal location of the first-aid center

An industrial park consists of 16 buildings. The corporations in the park are sharing the cost of construction and maintenance for a new first-aid center.

  Finding page faults for lru replacement algorithms

How many page faults would happen for the given replacement algorithms, assuming one, two, three, and four frames?

  Microsoft project file work breakdown structure

Update the Microsoft Project file you created in Assignment 1: VoIP Part 2 (Work Breakdown Structure) with the following changes

  Determine the edge connectivity of an undirected multigraph

Give a polynomial-time algorithm for this decision problem - determine the edge connectivity of an undirected multigraph

  Methods of generated data experiments

Overview of the different methods of generated data experiments - Some of visualization techniques are provided in this research to show how well the predictive modelling is performing and show an interesting method in the data related to the proje..

  Does a min-weight edge on every cycle

Consider that a graph has distinct edge weights. Does its lightest edge have to belong to the MST

  What data structure did you choose

what data structure did you choose (from lists, stacks, queues or trees) and why, and briefly explain why you did not choose the others.

  Consider a queue data structure

Consider a queue data structure, where the two operations of interest are enqueue (at the back of the queue) and dequeue (from the front of the queue). A queue is thus a FIFO (first in-first out) structure. Suppose we implement a queue by using tw..

  What is the time complexity of running the below bubblesort

Show a simple modification that can be made to the below bubblesort that significantly improves the time complexity for an array of sequential integers.

  Discuss the issues involved in managing software selection

Prepare a PowerPoint presentation which summarizes the background, requirements, analysis and reasons for your choice. Alternative presentation formats such as Prezi are acceptable

  Describe constant-time algorithms to insert item

Suppose that a singly linked list is implemented with both a header and a tail node. Using the ideas discussed in Exercise, describe constant-time algorithms.

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