Quote (FCNantes @ Jun 26 2012 10:56am)
I would say you have first to pur the first element of the arraylist at head then use the comparator to compare elements of your arraylist with head and nexts to sort correctly the list
How do you compare the elements tho, this is what I got so far...
Code
public SortableLinkedList(Comparator<T> comp, ArrayList<T> L) {
if(L == null){
head = null;
}
int index = 0;
head = (Node<T>) L.get(0);
Node<T> curr = head;
while(index < L.size()){
curr.next = (Node<T>) L.get(index);
index++;
}
while(index < L.size()){
L.get(index);
}
}
This post was edited by lopelurag on Jun 26 2012 09:06am