java - insertion-sort on doubly linked list -


Here is the entry-sort function for a double link list (DLL). It's based on. I get a NullPointerException . Why?

  public static DLL sort (DLL list) {DLLNode ptr2}  

= List.first.succ; While (ptr2! = Null) {DLLNode ptr1 = ptr2.pred; String Kar = PTR2. Alem; While (ptr1! = List.first & amp; amp; curu.compareToIgnoreCase (ptr1.elem) & lt; 0) {ptr1.succ.elem = ptr1.elem; Ptr1 = ptr1.pred; } Ptr1.succ.elem = curr; Ptr2 = ptr2.succ; } Return list; }

You can try to print your list backwards, this To make sure all your nodes Plague is not zero.

Comments