public class SingleList {
    public SingleNode head;
    public SingleNode tail;
    public int length;

    public boolean isEmpty() {
        return head == null;
    }

    public void insertAtTail(SingleNode node) {
        tail.next = node;
        tail = node;
        length++;
    }

    public void insertAtHead(SingleNode node) {
        node.next = head;
        head = node;
        length++;
    }

}
