Day 46: Review of the Tree Data Structure

Started out with the Tree data structure. I don’t know why I thought it was something else when I didn’t see binary included in the name. I have already spent a decent amount of time on binary trees so hopefully this will go much faster than I thought. I am interested in learning about Tries as well.

TLDR;

Okay, so here are the highlights of what I did:

  • Continued work on the “Technical Questions” section of the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. I started my work on Tree data structures. I started writing my notes off by covering the terminology used to describe the properties of trees. It’s a slow start but I have a whole queue of YouTube videos just waiting for me to go through them. LOL

Terms for trees

The Root of a Tree

The starting node of the tree (The Topmost node in the tree). This node has no parent. If the tree has more than one node then the root is the parent, grandparent, or ancestor of all other nodes and leaves in the tree.

A Parent Node

A parent node is a node that has child nodes that exist under it. For example, in the tree below, node 1 is a parent node to both node 2 and node 3.

    1
   / \
  2   3

A Child Node (Children)

A child node (children nodes) are nodes that exist directly below their parent node. They are referred to as the children of the parent node. For example, in the tree below, node 2 and node 3 are both child nodes (children) of node 1.

A Leaf Node

A leaf node is a node that has no children. For example in the tree below, node 2 and node 3 are both leaf nodes.

    1
   / \
  2   3

A Sibling Node

A sibling node is a node that share the same parent as the node it is being compared to. For example, in the tree below. Node 2 and node 3 are sibling nodes because they share the same parent node which is node 1.

    1
   / \
  2   3


Conclusion

That’s all for today. This is my sixth round of the “#100daysofcode” challenge. I will be continuing my work from round five into round six. I am currently working through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. My goal is to become more familiar with algorithms and data structures. This goal was derived from my goal to better understand operating systems and key programs that I use in the terminal regularly e.g. Git. This goal was in term derived from my desire to better understand the fundamental tools used for coding outside of popular GUIs. This in turn was derived from my desire to be a better back-end developer.

I have no idea if my path is correct but I am walking down this road anyways. Worst case scenario I learn a whole bunch of stuff that will help me out on my own personal projects.