We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4349aa5 commit 61e952aCopy full SHA for 61e952a
3.Compare two Linked Lists
@@ -0,0 +1,28 @@
1
+static boolean compareLists(SinglyLinkedListNode head1, SinglyLinkedListNode head2) {
2
+
3
+ boolean isEqual=false;
4
5
+ while(head1!=null && head2!=null){
6
7
+ if(head1.data==head2.data){
8
9
+ head1=head1.next;
10
+ head2=head2.next;
11
12
+ }
13
+ else{
14
15
+ return isEqual;
16
17
18
19
+ if((head1==null && head2!=null)||(head2==null && head1!=null)){
20
21
22
23
+ isEqual=true;
24
25
26
27
28
0 commit comments