traxaber / cs435-p2

0 stars 0 forks source link

Code Review #7

Open William-Vigo opened 4 years ago

William-Vigo commented 4 years ago

https://github.com/angdav/cs435-p2/blob/7773ebbbc02f04d5968b58217efb4db4635591ad/p7.py#L64

Another way of retracing your steps would be by using parent pointers. Once you found the goal state just traverse the parents until you reach start or None

traxaber commented 4 years ago

I agree that keeping track of parent pointers would work as well, but that's using the same amount of space for information that would only be used in this specific use case, where I need to count them. I prefer my implementation, where I create the space only when necessary.