presto-main/src/main/java/io/prestosql/execution/resourcegroups/StochasticPriorityQueue.java/Node/addNode
class Node:        public Node<E> addNode(E value, long tickets)
        {
            // setTickets call in base case will update totalTickets
            descendants++;
            if (left.isPresent() && right.isPresent()) {
                // Keep the tree balanced when inserting
                if (left.get().descendants < right.get().descendants) {
                    return left.get().addNode(value, tickets);
                }
                else {
                    return right.get().addNode(value, tickets);
                }
            }

            Node<E> child = new Node<>(Optional.of(this), value);
            if (left.isPresent()) {
                right = Optional.of(child);
            }
            else {
                left = Optional.of(child);
            }
            child.setTickets(tickets);
            return child;
        }