From e343ea0ffb7c0daa80f26eb8264380ddb5269b71 Mon Sep 17 00:00:00 2001 From: Udhay <72250606+Udhay-Brahmi@users.noreply.github.com> Date: Wed, 16 Dec 2020 08:04:07 +0530 Subject: [PATCH] Create Compare two linked lists --- Compare two linked lists | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Compare two linked lists diff --git a/Compare two linked lists b/Compare two linked lists new file mode 100644 index 0000000..4368a60 --- /dev/null +++ b/Compare two linked lists @@ -0,0 +1,16 @@ +int compare(Node *list1, Node *list2) +{ + // Code Here + string h="",j=""; + while(list1!=NULL){ + h+=list1->c; + list1=list1->next; + } + while(list2!=NULL){ + j+=list2->c; + list2=list2->next; + } + if(h==j){return 0;} + else if(h>j){return 1;} + return -1; +}