- #1
- 1,231
- 0
I'm just posting a random graph algorithm problem for discussion fodder, since another interesting graph algorithm post was removed due to a threatening-sounding title and lead-up. This is from Cormen, Leiserson, Rivest, & Stein, 22.4-3 (not a homework problem of any kind, just for fun--I had algorithms a year ago). It should be pretty accessible to all audiences:
Give an O(|V|) algorithm that determines whether or not an undirected graph G = (V, E) contains a cycle.
Hint (highlight): if the graph has at least |V| edges you know it's cyclic
If you answer this, why not post your own interesting mathematical CS question! (don't post homework)
Give an O(|V|) algorithm that determines whether or not an undirected graph G = (V, E) contains a cycle.
Hint (highlight): if the graph has at least |V| edges you know it's cyclic
If you answer this, why not post your own interesting mathematical CS question! (don't post homework)