Binary trees are hierarchical data structures that store nodes with zero, one or two child nodes. The root node is at the top and child nodes are directly connected below their parent node. Trees allow for quick access and search of hierarchical data, as well as faster insertion and deletion compared to arrays. Common applications of trees include manipulating hierarchical data like file systems, router algorithms, and tree traversal methods for easy searching of information.
2. BINARY TREE
Trees: Unlike Arrays, Linked Lists, Stack and queues, which are linear data structures,
trees are hierarchical data structures.
3. BINARY TREE
Tree Vocabulary: The topmost node is called root of the tree. The elements that are
directly under an element are called its children. The element directly above something
called its parent. For example, a is a child of f, and f is the parent of a. Finally,
elements with no children are called leaves.
4. WHY TREES ?
One reason to use trees might be because you want to store information that naturally
forms a hierarchy. For example, the file system on a computer: