Insertion sort in doubly linked list HELP ME RHONDA!
This code causes my program to never stop running, I can't figure out why it will not sort the list.
publicvoid insertionSort()
{
Node pointer=head;
while(pointer.next!=null)
{
Node insert=pointer.next;
if (insert.item.compareTo(pointer.item)>0)
{
pointer=pointer.next;
}
else
{
insert.prev.next=insert.next;
insert.next.prev=insert.prev;
if (head.item.compareTo(insert.item)>0)
{
insert.next=head;
insert.prev=null;
head.prev=insert;
head=insert;
}
}
}
}

