Data Structures: Trees Flashcards
What are tree stuctures?
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties − The left sub-tree of a node has a key less than or equal to its parent node’s key. The right sub-tree of a node has a key greater than to its parent node’s key.
Tree structure operations
addChild
removeChild
traverse
Common uses for a tree structure
for storing hierarchical data with a directed flow.
Three kinds of traversals
preorder: the root node of the tree is processed first, then the left subtree is
traversed, then the right subtree.
postorder: the left subtree is traversed, then the right subtree, and then the root node is processed.
inorder: the left
subtree is traversed first, then the root node is processed, then the right subtree is traversed.