In an interview I got asked to implement an algorithm that counts the number of trees in a forest. My implementation was far from perfect so later I tried to improve the algorithm as much as I could and the following is what I have got for the moment but before I begin let’s define some terms. A Forest is a graph for which we have the number of nodes and a list of edges.
Continue reading

Author's picture

Mehran Kordi

Software Developer


Paris, France