how we can check a linkedlist of char have a palindrom or not
but without distrubing pointers of linklist

how we can check a linkedlist of char have a palindrom or not

The same way you do it with an array. Walk two iterators from each end toward the middle until they meet. If the iterators match the whole way, the sequence is a palindrome. Of course, if the list is singly linked, you cannot have an iterator from back to front, but that is easy to work around with a little extra effort. Recursion comes to mind as a first attempt, even though it is not the best use of recursion. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.