Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def palindrome(head):
  2. return palindrome_rec
  3.  
  4.  
  5. def palindrome_rec(head, tail):
  6. if (head == tail):
  7. return TRUE
  8. if (head.data != tail.data):
  9. return FALSE
  10. palindrome(head.next, get_previews_node(head, tail))
  11.  
  12.  
  13. def get_previews_node(head, tail):
  14. if (head.next == tail):
  15. return head
  16. get_previews_node(head.next, tail)
  17.  
  18.  
  19. def palindrome_help(head):
  20. if (head.next == None):
  21. return head
  22. palindrome_help(head.next)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement