Hi stack overflow. I need to insert some objects contained in a Node class into a LinkedList class in a sorted over. The Node class looks like:
public class Node {
private Card val;
private Node next;
public Node(Card v) {
val = v;
next = null;
}
where card implements the Comparator interface. I'm trying to write a function to insert these cards in sorted order (low to high) by card value in a LinkedList class (not the java.util.LinkedList class but a linked-list class I'm writing). Does anybody know how I could do this? Also it can't be a doubly-linked list.