Hi everyone!
This past week was quite stressful - studying for Term Test 2 took a lot of time to make the sheet aid that I felt was suitable enough for the test.
The test itself wasn't too bad. Nothing to held my head up too high on, but I feel I understood what all three questions were asking and answered them to my best ability.
The first question involved questions about trees, specifically part A) asked what is the longest and smallest path in a 20 node tree. What I imagined was that a 20 node tree can have an arity (branching factor) of 1, thus the longest path can only be 2 nodes. Contrastingly, a 20 node tree could have an arity of 19, which can only lead a branching factor of 2. It felt quite awkward drawing the diagrams for these and it felt like something was flawed with my approach, but I had no idea in my mind and my aid sheet had nothing on smallest path either. Part b) of Q1 gave a tree and instructed us to organize in the post-order approach of a BST. I used my aid sheet definition and followed it up by vising the left child node, right child node and the main parent node itself.
The second question was implementing a BTNode tree, which was eerily similar to list_internal_between from the recent Lab, but it wanted even numbers from all the roots to be transported inside a list. Only a slight alteration was required on the final if statement for the code to include if the value % 2 ==0. This guaranteed only even numbers enter the list.
The 3rd and final question has me worried. I wasn't too confident with LinkedLists going into the test and I couldn't figure out a way to properly implement this function. I again referred to aid from my aid sheet and used my best judgement with comments to answer the question. Hopefully I get part marks for it!
In lecture, BSTs were covered more in-depth this time around, but nothing too different from what was already learned by doing the lab for that week.
No comments:
Post a Comment