I already explained Trees. Binary Search Trees (BSTs) are just like Trees, except there is one more rule applied when appending nodes to the Tree:
When appending nodes to the tree, if the value of the node is (less/more) than the value of the root, then append the node to the (left/right) subtree. If the (left/right) subtree doesn't exist, then the node in question becomes the root of a new (left/right) subtree.
This rule makes BSTs much nicer to work with then regular trees. Since BSTs have this rule when they're being created, they have properties that can make your methods and functions much more effecient. For example, they allow your searches to become binary searches, since the values in in-order traversal is now in perfect ascending order.
This is pretty much everything I know about BSTs, but I know that there is more to them than that. All of the BSTs that we've worked with in class and in labs are designed in a different way. They seem to use two different classes: The BST class, and the BST Node class. I never took the time to figure out exactly what each class is supposed to do and what properties they're supposed to hold. Because of this, I suffered during lab 8 when we had to design functions that required full understanding of these 2 classes.
It's my SLOG and I'll cry if I want to. Besides my trouble with BSTs, I've been experiencing woes in a few other parts of this course so far. I got 0 on the last question in the first term test, and I lost my test once it was returned to me. Since I can't compare the correct answer to my answer, that's enough reasoning for the emotional part of my brain to decide not to look up how to properly answer the question. I submitted e3 early and the autograder returned 3 failures and 1 success. The autograder says things about AssertionError. What is that? I finished 3 of the 4 required functions for A2PII. The 3 ones I finished work perfectly to me, but are pretty messy. I drove myself crazy yesterday trying to map out on paper how to properly write the body for all_regex_permutations(s).
I should see if spending time at the CS help center or getting another peer tutor like last semester would help.
No comments:
Post a Comment