-
-
Save Preetiraj3697/1d649cd6c37a726fae6fa892ed9687de to your computer and use it in GitHub Desktop.
Comparing Two Linked Lists | JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CompareLists(a, b) { | |
while(a!==null && b!==null){ | |
if(a.data !== b.data){ | |
return 0 | |
}else{ | |
a=a.next; | |
b=b.next; | |
} | |
} | |
if(a==null && b==null){ | |
return 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comparing Two Linked Lists | JS