Created
December 16, 2019 19:05
-
-
Save rahul4coding/aaf6dbb61f9c74da59ecd6604b3a1e37 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