CSCI-UA 102 (Data Structures)

Binary Trees and Binary Search Trees

Part 1

a tree

Part 2

a tree

Part 3

You are told that the preorder and postorder traversals of a given tree are as follows:

preorder: A B C D E F G H I

postorder: C E D B H G I F A

Construct a tree for which this is the case.

Part 4

In a binary search tree the values stored in a left subtree of a node have values smaller than it, and the values store in a right subtree of a node have values larger than it. This has to be true for every node in the tree.

This is an example of a binary search tree:

a tree