Closed ChrisVilches closed 2 years ago
Yes, it was incorrect. It created a new connected component object for every node even if it was already visited.
But since I had an array limit of 200 elements (the maximum possible, in the case where there are no edges at all), it never exceeded the array limits. Therefore the knapsack just had to deal with more objects, but the result is the same, since repeated objects don't impact the algorithm.
Increases component count even if the node has been visited (and does a DFS).
Maybe this assumption is incorrect. Check code.