This week in class was a continuation of last weeks topic, linked structures, which are inherently recursive structures. To study the concept we looked at linked lists which are data structures which
are made up of nodes, with each node having a value and a reference to the next object in the sequences.
For the linked list nodes we designed a wrapper class that can keep track of certain attributes of the linked list, such as size and the object at the very front, without making the user initialize them when creating the object. We wrote the bodies of functions that insert, delete, and reverse linked lists, all using recursion and the wrapper class attributes of size and front object to create base cases for the recursion.
We then looked at binary search trees (BST), another recursive data structure, which resembles tree data structures but a pre-condition of all BSTs is that the left child of the root is smaller than the root and the right child is larger than the root. We looked at how class methods can be made easier by creating helper functions indented within the methods that will do most of the functions job, and then a simple return statement can be called on the helper function with certain parameters changed, as seen in the insert method of BSTNode.
I was very content with this week's material because I felt I had a good understanding of the recursive nature of linked structures and binary search trees to the point of me having very little trouble creating methods regarding manipulating these data structures.
Until Next Week,
Maxim Isakov
No comments:
Post a Comment