Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
- if (head1->data != head2->data ) return 0 ;
- if ( head1->next == nullptr && head2->next == nullptr ) return 1;
- if ( head1->next == nullptr && head2->next != NULL ) return 0 ;
- if (head2->next == NULL && head1->next != NULL) return 0;
- return compare_lists(head1->next, head2->next);
- }
Advertisement
Add Comment
Please, Sign In to add comment