In the deadlock chapter, in resource allocation graph algorithm, it is given that detecting a cycle takes O(n^2) operations... But we can find cycle in O(n+m) operations, using DFS. Why they have not considered this.. or if they have considered, what am I missing. Or is it that they have given worst case time assuming #edges(i.e; m)=n(n-1)/2 which would give O(n^2)?