Lab 9 was really boring I think. It's one thing to come up with test cases and it's another to write them up. On the bright side, there were some interesting "testing" questions. For delete, what's the best way to test it works? Obviously, you can ask if the result is "what you should have gotten based on the known algorithm" but as I briefly touched upon last post, there may be more than one valid trees outputted after deleting. My approach was to 1) check that the value disappears if any, 2) check that the tree remains in "good shape" (ie. the BST conditions are maintained) by travelling in order.
You can easily see that in-order traversal results in "sorted nodes" iff the BST is maintained.
Also, I found a bug in bt_functions.py for the bst_contains method.
I think based on this lab, I think I know how to autotest my minimax. I can add a tester function that keeps track of all the states it visited (or print something about it) and then see if it matches my expectation.
In any case, this week there should have been a very wide range of possible solutions. Mine is shown below, but I would recommend that you don't waste your time reading through it:
No comments:
Post a Comment