You are viewing a single comment's thread. Return to all comments →
This worked for me (Java):
Node SortedInsert(Node head,int data) { Node n = new Node(); n.data = data; if (head == null) { return n; } else if (data <= head.data) { n.next = head; head.prev = n; return n; } else { Node rest = SortedInsert(head.next, data); head.next = rest; rest.prev = head; return head; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Inserting a Node Into a Sorted Doubly Linked List
You are viewing a single comment's thread. Return to all comments →
This worked for me (Java):