@@ -0,0 +1,1203 @@
+/*%0A  Insert Node at the end of a linked list%0A  head pointer input could be NULL as well for empty list%0A  Node is defined as%0A  class Node %7B%0A     int data;%0A     Node next;%0A     Node prev;%0A  %7D%0A*/%0A%0ANode SortedInsert(Node head,int data) %7B%0A%0A    // Create new node%0A    Node temp = new Node();%0A    temp.data = data;%0A    temp.next = null;%0A    temp.prev = null;%0A%0A    // Check if list is empty%0A    if (head == null) %7B return temp; %7D%0A%0A%0A    // Insert at head%0A    Node curr = head;%0A    if (temp.data %3C= curr.data) %7B%0A        curr.prev = temp;%0A        temp.next = curr;%0A        return temp; // Return new head%0A    %7D%0A%0A    // Iterate through list%0A    while (curr.next != null)%7B%0A        if (temp.data %3C= curr.data)%7B%0A            curr.prev.next = temp;%0A            temp.prev = curr.prev;%0A            temp.next = curr;%0A            curr.prev = temp;%0A            return head;%0A        %7D%0A        curr = curr.next;%0A    %7D%0A%0A    // At last node%0A    if (temp.data %3C= curr.data)%7B // Insert before last node%0A        curr.prev.next = temp;%0A        temp.prev = curr.prev;%0A        temp.next = curr;%0A        curr.prev = temp;%0A        return head;%0A    %7D%0A%0A    // Insert at tail%0A    curr.next = temp;%0A    temp.prev = curr;%0A    return head;%0A%0A%7D%0A

solve insert node into double linked list