# Question: provide an algorithm that given an undirected graph g with...

###### Question details

Provide an algorithm that given an undirected graph G with n vertices and m edges as input, finds out whether G contains a cycle. Verify that your algorithm runs in O(n + m) time and Provide an algorithm that given a directed graph G with n vertices and m edges as input, finds out whether G contains a cycle. Verify that your algorithm runs in O(n + m) time