Lecture Notes on 30 Mar 2022 * Slides on Tress https://www.cs.utexas.edu/users/mitra/csSpring2022/cs313/notes/Trees.pdf * Pictorial Representation of Trees https://www.cs.utexas.edu/users/mitra/csSpring2022/cs313/notes/Binary_Trees.pdf * Operations and Algorithms on Binary Search Trees * Define a Node: - data - lchild - rchild * Create an Empty Tree - root = None * Insert elements in the Tree - create Node - find unique location in Tree and add - new addition always a leaf node * Find a node containing some data value in Tree - always start at the root - go left if data value is less than node value - go right if data value is greater than node value * Find minimum value in a Tree - go left until you hit a node that does not have a left child * Find maximum value in a Tree - go right until you hit a node that does not have a right child * Traverse a Tree - traverse a Tree means to visit every node just once - the following algorithms looks upon the Tree as a recursive data structure * Inorder Traversal - start at the root - recursively go to the left subtree - visit root and print - recursively go to the right subtree * Preorder Traversal - visit root and print - recursively go to the left subtree - recursively go to the right subtree * Postorder Traversal - recursively go to the left subtree - recursively go to the right subtree - visit root and print * Expression Tree https://en.wikipedia.org/wiki/Binary_expression_tree