LinkedList/palindrome_linked_list library

🎭 Palindrome Linked List Algorithm

Efficient algorithm to check if a linked list is a palindrome. Uses the two-pointer technique to find the middle and reverse the second half.

Time Complexity: O(n) where n is the length of the list Space Complexity: O(1)

Functions

isPalindrome<T>(LinkedListNode<T>? head) → bool
Checks if a linked list is a palindrome
isPalindromeRecursive<T>(LinkedListNode<T>? head) → bool
Checks if a linked list is a palindrome using recursive approach
isPalindromeWithArray<T>(LinkedListNode<T>? head) → bool
Checks if a linked list is a palindrome using array approach
isPalindromeWithStack<T>(LinkedListNode<T>? head) → bool
Checks if a linked list is a palindrome using stack approach
reverseLinkedList<T>(LinkedListNode<T>? head) → LinkedListNode<T>?
Helper function to reverse a linked list