You are viewing a single comment's thread. Return to all comments →
Here's my code in C++/C
bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) { SinglyLinkedListNode *ptr1 = head1 ; SinglyLinkedListNode *ptr2 = head2 ; //traverse while(ptr1!=NULL && ptr2!=NULL){ if(ptr1->data != ptr2->data){break;} ptr1 = ptr1->next ; ptr2 = ptr2->next ; } if(ptr1==NULL && ptr2==NULL){return 1 ;} return 0 ; }
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 →
Here's my code in C++/C