add hasCycle.cpp detectCycle.cpp