It's the 6th week of CSC148 and that means it's the last week before reading week. This week's focal point was on trees. We learned some basic terminology and how trees worked within a program.
 |
| Not exactly like these trees per se. |
The most important use of a tree is that it can be used to represent hierarchical relationships. This can be the structure in a program, relationships in an mathematical expression or directory structures. In programming, trees are an ADT (abstract data type) which consists of a root value and several subtrees linked by nodes.
 |
| A visualization of a tree used in programming. |
Our professor did an interactive example during our Monday lecture. She made the student in the back row of the class stand up and he became the root of the tree. He would subsequently point to two other students in the next row to stand up and those students would point to two more students and so forth.
We studied this further in our labs where we would implement recursive functions when the input was a tree. Trees seem relatively simple to understand but the core concept behind recursive functions and how they work is a must. I struggled with recursion the past week but I was able to catch up and understand. Now, trees are a relatively simple concept to grasp.
No comments:
Post a Comment