Check palindrome in given Linked List
There are many ways to check given linked list elements are contains palindrome. We can solve this problem by using of Stack and Recursion are very easily. In this post mentioning both ways to solve this problem solution.
Method 1: This is a simplest solution of this problem. Create a empty stack and first insert all elements of linked list into an stack. After that comparing the stack top (root) element is equal to linked list node. When it is equals then remove stack top element.
Similar way compare stack top elements to linked list upcoming nodes. If stack and current linked list nodes are not same then in this case linked list are not contain palindrome. Otherwise exist.

1) Check palindrome in given linked list using stack in java
2) Check palindrome in given linked list using stack in c++
3) Check palindrome in given linked list using stack in c
4) Check palindrome in given linked list using stack in c#
5) Check palindrome in given linked list using stack in php
6) Check palindrome in given linked list using stack in node js
7) Check palindrome in given linked list using stack in python
8) Check palindrome in given linked list using stack in ruby
9) Check palindrome in given linked list using stack in scala
10) Check palindrome in given linked list using stack in swift
11) Check palindrome in given linked list using stack in kotlin
12) Check palindrome in given linked list using stack in golang
13) Check palindrome in given linked list using stack in typescript
14) Check palindrome in given linked list using stack in vb.net
Method 2 Recursion is an another way to find palindrome in given linked list. Here given code implementation process.

1) Check if linked list is palindrome using recursion in java
2) Check if linked list is palindrome using recursion in c++
3) Check if linked list is palindrome using recursion in c
4) Check if linked list is palindrome using recursion in c#
5) Check if linked list is palindrome using recursion in php
6) Check if linked list is palindrome using recursion in python
7) Check if linked list is palindrome using recursion in ruby
8) Check if linked list is palindrome using recursion in scala
9) Check if linked list is palindrome using recursion in swift
10) Check if linked list is palindrome using recursion in golang
11) Check if linked list is palindrome using recursion in node js
12) Check if linked list is palindrome using recursion in typescript
13) Check if linked list is palindrome using recursion in vb.net
14) Check if linked list is palindrome using recursion in kotlin
Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.
New Comment