Untitled
unknown
plain_text
a year ago
760 B
2
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