Untitled
unknown
plain_text
2 years ago
760 B
3
Indexable
public Node() {
}
public Node(int id, int team, int score) {
this.id = id;
this.team = team;
this.score = score;
}
Node next, prev;
}
class DoubleLinkedList{
Node head, tail;
public DoubleLinkedList(){
head = new Node();
tail = new Node();
link(head, tail);
}
public void link(Node lf, Node rt) {
lf.next = rt;
rt.prev = lf;
}
public void insert(Node node) {
if (head.next != tail) {
link(node, head.next);
link(head, node);
} else {
link(node, tail);
link(head, node);
}
}
}Editor is loading...
Leave a Comment