LL Java
LL Java
*;
class Node {
int data;
Node next;
Node prev;
Node (int x){
data = x;
next = null;
prev = null;
}
return a;
Node temp = a;
Node previous = null;
while(temp!= null && temp.data != k){
temp = temp.next;
}
temp.next = add;
add.prev = temp.next;
add.next = temp.next.next;
return a;
}
}
public static void main(String[] args) {
Node a = new Node (5);
Node b = new Node (10);
Node c = new Node (15);
Node d = new Node (20);
a.next = b;
b.prev = a;
b.next = c;
c.prev = b;
c.next = d;
d.prev = c;
}
}
/////tenth of october
import java.util.*;
import java.lang.*;
import java.io.*;
}
return slow;
}
}
return prev;
}
public static Node recurseReverse(Node head){
if (head == null || head.next == null){
return head;
}
Node ans = recurseReverse(head.next);
head.next.next = head;
head.next = null;
return ans;
}
if (temp1== null){
res.next = temp2;
}
if(temp2 == null){
res.next = temp1;
}
}
return ans.next;
}