You are viewing a single comment's thread. Return to all comments →
How abt this ?
int CompareLists(Node headA, Node headB) { Node currA = headA; Node currB = headB; int test = 0; while (currA != null && currB != null){ if(currA.data != currB.data){ test = 0; return test; } currA = currA.next; currB = currB.next; } if(currA == null && currB == null) { test = 1; }
return test; }
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 →
How abt this ?
int CompareLists(Node headA, Node headB) { Node currA = headA; Node currB = headB; int test = 0; while (currA != null && currB != null){ if(currA.data != currB.data){ test = 0; return test; } currA = currA.next; currB = currB.next; } if(currA == null && currB == null) { test = 1; }
return test; }