This implementation uses a nonrecursive, queue-based algorithm. The constructor takes time proportional to
V + E (in the worst case), where V is the number of vertices and E is the number
of edges. Afterwards, the hasOrder and rank operations takes constant time; the order
operation takes time proportional to V.
This implementation uses a nonrecursive, queue-based algorithm. The constructor takes time proportional to
V + E (in the worst case), where V is the number of vertices and E is the number of edges. Afterwards, the hasOrder and rank operations takes constant time; the order operation takes time proportional to V.