So we just wrote the second test yesterday. I really hate sometimes how hindsight is 20/20. You’re sitting there going through the test and thinking about your answers, you write down some code, and you eventually finish the test. Then you re-read it and are checking your answers and the time is up – and you’ve just realized some mistakes in your code.

But it’s too late to fix it. Just another minute! Just another two minutes! That kind of stuff really sucks.

Anywho, let’s talk about what I did wrong on my test (to my knowledge)…

Question one had us working with binary search trees and posed the question of whether or not an inorder traversal is a sorted list. The fool that I am, I totally forgot that in a binary search tree, **all** nodes to the left of a root node are smaller than the root node. So you can probably interpolate that I answered no to the question when the answer is, yes, an inorder traversal of a BST is indeed an ordered list.

Here’s the binary tree I constructed as an example (or it was something like this):

5

4 6

3 7 9

So the inorder traversal of **that** tree would be 3,4,7,5,6,9. The seven and the 5 are out of order. I thought I had proved my point – but at the end of the test, when I was quickly making sure of my answers, I realized that this -wasn’t- a BST since 7 is not allowed to be to the left of 5 in a BST. I did not have time to fix it. I was fixing other mistakes when the time ran out.

The other thing I made a mistake on was returning None if a tree whose leaves were removed became empty. I forgot to make that happen in my code for question #3. It’s such a small, easy-to-do thing, but yet I only realized that I had neglected it in the last 15 or so seconds. Quite literally the last 15 or so seconds. I remember the feeling in my gut.

I know striving to write the correct, perfect code, the first time around is what we should aim for. But that’s quite difficult to do, and I also know that. I should have taken a bit more time to think through what I was doing, probably. But dang, that sucks. Identifying mistakes yourself, -during- a test and simply not having the time to fix them.

Damn. Damn, damn, damn. Ah well. You live and you learn.