Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def palindrome(head):
- return palindrome_rec
- def palindrome_rec(head, tail):
- if (head == tail):
- return TRUE
- if (head.data != tail.data):
- return FALSE
- palindrome(head.next, get_previews_node(head, tail))
- def get_previews_node(head, tail):
- if (head.next == tail):
- return head
- get_previews_node(head.next, tail)
- def palindrome_help(head):
- if (head.next == None):
- return head
- palindrome_help(head.next)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement