You are viewing a single comment's thread. Return to all comments →
bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
int c=0; while(head1!=NULL || head2!=NULL) { if(head1==NULL || head2==NULL) { return 0; } if(head1->data == head2->data){ c=c+1; } else { c=0; break; } head1=head1->next; head2=head2->next; } if(c==0) { return 0; } else { return 1; }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Compare two linked lists
You are viewing a single comment's thread. Return to all comments →
bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
}