27 Lecture

CS301

Midterm & Final Term Short Notes

Properties of Binary Tree

Binary trees have the following properties: Each node has at most two children. The left child of a node contains a value less than the node's value, and the right child contains a value greater than or equal to the node's value. A binary t


Important Mcq's
Midterm & Finalterm Prepration
Past papers included

Download PDF
  1. Which of the following statements is true about a binary tree? A. Each node has exactly two children B. Each node has at most two children C. Each node has at least two children D. Each node has exactly one child

Answer: B

  1. In a binary tree, a node is said to be a leaf node if: A. It has no children B. It has exactly one child C. It has at least one child D. It has two children

Answer: A

  1. A binary tree is said to be a complete binary tree if: A. All the nodes in the tree have the same value B. Each node has at most two children C. Each level of the tree is completely filled D. The tree is balanced

Answer: C

  1. Which of the following traversal methods visits the left subtree, then the root, and finally the right subtree? A. Preorder B. Inorder C. Postorder D. Level order

Answer: B

  1. A binary tree is said to be balanced if: A. All the nodes have the same value B. Each node has at most two children C. The height of the left and right subtrees of any node differ by at most 1 D. The tree is complete

Answer: C

  1. In a binary tree, the maximum number of nodes at level k is: A. 2^k B. k^2 C. 2k D. 2^(k-1)

Answer: A

  1. The number of edges in a full binary tree with n nodes is: A. n-1 B. n C. 2n-1 D. 2n

Answer: C

  1. Which of the following statements is true about a binary search tree? A. Each node has at most two children B. The left subtree of a node contains only nodes with values less than the node's value C. The right subtree of a node contains only nodes with values greater than the node's value D. All of the above

Answer: D

  1. A binary tree in which every non-leaf node has non-empty left and right subtrees is called a: A. Full binary tree B. Complete binary tree C. Balanced binary tree D. None of the above

Answer: A

  1. In a binary tree, the height is defined as: A. The number of nodes in the tree B. The number of edges from the root to the farthest leaf node C. The number of levels in the tree D. The number of subtrees in the tree

Answer: B



Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included

Download PDF
  1. What is a binary tree? A binary tree is a data structure in which each node has at most two children, referred to as the left child and the right child.

  2. What is the height of a binary tree? The height of a binary tree is the maximum number of edges between the root node and any leaf node in the tree.

  3. What is a full binary tree? A full binary tree is a binary tree in which every node other than the leaves has two children.

  4. What is a complete binary tree? A complete binary tree is a binary tree in which all the levels are completely filled except possibly for the last level, which is filled from left to right.

  5. What is a balanced binary tree? A balanced binary tree is a binary tree in which the difference in height between the left and right subtrees of any node is at most one.

  6. What is an AVL tree? An AVL tree is a self-balancing binary search tree in which the heights of the left and right subtrees of every node differ by at most one.

  7. What is a red-black tree? A red-black tree is a self-balancing binary search tree in which each node has a color either red or black, and the root node is always black.

  8. What is an expression tree? An expression tree is a binary tree in which each internal node represents an operator and each leaf node represents an operand.

  9. What is a binary search tree? A binary search tree is a binary tree in which the left subtree of a node contains only nodes with values less than the node's value, and the right subtree contains only nodes with values greater than the node's value.

  10. What is the maximum number of nodes in a binary tree of height h? The maximum number of nodes in a binary tree of height h is 2^(h+1) - 1.

A binary tree is a fundamental data structure in computer science and is used to store data in a hierarchical structure. Here are some of the important properties of binary trees:
  1. Every node has at most two children: A binary tree is a tree data structure where each node can have at most two children, which are referred to as left and right children.
  2. Left and right subtrees: Every node in a binary tree has a left and a right subtree, which can be empty or non-empty.
  3. Height: The height of a binary tree is the length of the longest path from the root to any leaf node.
  4. Depth: The depth of a node is the length of the path from the root to that node.
  5. Full binary tree: A binary tree is said to be full if every node has either zero or two children.
  6. Complete binary tree: A binary tree is said to be complete if all levels of the tree are completely filled, except for the last level, which can be partially filled.
  7. Perfect binary tree: A binary tree is said to be perfect if all levels of the tree are completely filled.
  8. Balanced binary tree: A binary tree is said to be balanced if the height of the left and right subtrees of any node differ by at most one.
  9. Skewed binary tree: A binary tree is said to be skewed if all of its nodes have only one child.
  10. Binary search tree: A binary search tree is a binary tree where the value of each node in the left subtree is less than or equal to the value of the node, and the value of each node in the right subtree is greater than the value of the node.