Reputation: 1
I'm using an ArrayList and then using contains to see if the new node is already explored. Is there a better way? Time and space wise?
Upvotes: 0
Views: 52
Reputation: 11
HashSet, alternatively if you are worried about duplicate keys a HashMap where the key is the Nodes HAshValue and the Value is the node
Upvotes: 1