In your DFS and BFS function, you used the == function to determine whether the node was found. Though this works for this occasion, if there are two nodes with the same value, this will fail. If you are looking for a specific node, it might be better to use "is" to determine if it is the exact same node object.
In your DFS and BFS function, you used the == function to determine whether the node was found. Though this works for this occasion, if there are two nodes with the same value, this will fail. If you are looking for a specific node, it might be better to use "is" to determine if it is the exact same node object.