DATA STRUCTURES AND
ALGORITHMS (TREE TYPES) EXAM
QUESTIONS AND ANSWERS
Binary Tree - Correct Answers -every node has at most two children
Binary Tree Traversal - Correct Answers -1. Depth First
2. Breadth first
Depth First Traversal - Correct Answers -1. Inorder
2. Preorder
3. Postorder
Postorder Traversal - Correct Answers -left subtree, right subtree, root
Breadth First Traversal - Correct Answers -root is processed first, all its children are
next, then all of their children, etc. down to the bottom
Binary Search Tree - Correct Answers -a binary tree with properties that include: key in
each node must b greater than all keys stored in the left subtree and smaller than all
keys in the right subtree; each subtree itself is a binary tree
Inorder Traversal - Correct Answers -left subtree, root, right subtree
Preorder Traversal - Correct Answers -root, left subtree, right subtree
Inserting an item in BST - Correct Answers --first value inserted as root
-every node after becomes a leaf
-insert left or right depending on value
ALGORITHMS (TREE TYPES) EXAM
QUESTIONS AND ANSWERS
Binary Tree - Correct Answers -every node has at most two children
Binary Tree Traversal - Correct Answers -1. Depth First
2. Breadth first
Depth First Traversal - Correct Answers -1. Inorder
2. Preorder
3. Postorder
Postorder Traversal - Correct Answers -left subtree, right subtree, root
Breadth First Traversal - Correct Answers -root is processed first, all its children are
next, then all of their children, etc. down to the bottom
Binary Search Tree - Correct Answers -a binary tree with properties that include: key in
each node must b greater than all keys stored in the left subtree and smaller than all
keys in the right subtree; each subtree itself is a binary tree
Inorder Traversal - Correct Answers -left subtree, root, right subtree
Preorder Traversal - Correct Answers -root, left subtree, right subtree
Inserting an item in BST - Correct Answers --first value inserted as root
-every node after becomes a leaf
-insert left or right depending on value