INB221 Lecture Notes - Tree Traversal, Binary Search Tree, Binary Tree
Document Summary
They are used in biological classifications for living organisms. They are also used for businesses, so that each employee reports to a single supervisor, up to the ceo at the root. Family trees provide a lot of the terminology for the compsci tree structure. Parent and child relationships can be modeled with pointers, so that there"s a direct link between a parent node and achild node. Each node can contain data specific to that node (if you"re modeling a family tree, you"d have the name as the data of the node), and then pointers to its children. The node would be a struct or a class, and then tree as a pointer to a node. Trees are pointers to nodes, and nodes contain trees. If you isolate henry i on the previous slide, the structure of nodes below is a. Picture of data structure of tree on slides. In a binary tree, each tree has at most 2 children.