We had our second midterm of the course this week. It focused on recursion, and I wasn't very comfortable after learning from that most of the students came almost crying after the recursion midterm previous term. Yet, I feel Danny showed some mercy and gave us a doable test. I put good use my aid-sheet in second question after quickly working out the first one on my own. Third question was the trickiest one, but I spent some time before I figured it out as well. I used the approach of drawing the illustration of a linked list, and analyzing the problem. It worked pretty well and overall, I was happy with the exam.
The Monday before the exam, we went through Binary Search trees in class. I liked the way of gathering data such that we can have certain comparable conditions applied on the child nodes which makes it easier to traverse to the required point. In our work, we ensured the left child has a value less than the parent node, and the right child has a value greater than the parent node itself.
A Binary Search Tree
So now if we consider the example above, and we need to find the number 13, starting from 15, we know that 13 is less than 15, so it will lie somewhere in the left sub-tree, and further 13 being greater than 11, would lie to the right sub-tree of 11, which specifically is the leaf. This way, we reduce the steps the program would have otherwise taken to reach the required 13.
This week, 4 Midterms in 3 Days, wish for me. Please do!
No comments:
Post a Comment