why we need to maintain parent array?. we can find the cycle using only visited array using dfs. if the new node points to the visited node it means it is a back edge and has a cycle. so what is point of keeping parent array?
why we need to maintain parent array?. we can find the cycle using only visited array using dfs. if the new node points to the visited node it means it is a back edge and has a cycle. so what is point of keeping parent array?