I hope everybody was very happy that reading week had officially began (I know I was). The topic in lectures this week, Trees was very interesting. This data structure was of a new type, something we never seen before. Trees organize data in a non linear fashion, unlike lists and stacks, trees are organized with respect to the hierarchy of the data. Every tree has one root node, and children belonging to that root. These children can either be subtrees - another tree with lower hierarchy than the root node - or a leaf node - node with no children.
Dan mentioned that trees were similar to the structure of a HTML document, and since a friend of mine has been learning HTML lately, I checked for myself. I thought it was pretty cool when I confirmed it myself. My buddy showed and discussed how the HTML document was organized with respect to the importance of the data in the document. Furthermore, we could relate trees to dictionaries, whereby each root of the tree is a key in a dictionary and the subtrees are values in the dictionary, which are also dictionaries. However you can see this would get messy because there can only be one reference to a specific key in a dictionary. Thus, that right there is what makes trees unique.
No comments:
Post a Comment