answer:

O(N2) since there are at most N2 arcs