Tree Height and Depth Quiz

FinerCarnelian5448 avatar
FinerCarnelian5448
·
·
Download

Start Quiz

Study Flashcards

18 Questions

What is the maximum number of children a node can have in a binary tree?

2

What is the height of node B in the given binary tree?

3

Which of the following nodes is a leaf node?

E

What is the degree of node F in the given binary tree?

3

What is the depth of node I in the given binary tree?

2

Which of the following nodes is a part of the subtree rooted at node F?

I

In a binary tree, what is the maximum number of children a node can have?

2

In a binary tree, how many subtrees does each internal node have?

2

What is the degree of a node in a binary tree?

The number of edges connected to the node

What is the depth of a node in a binary tree?

The number of edges from the node to the root

What is the height of a binary tree?

The number of edges in the longest path from the root to a leaf

What is a path in a binary tree?

A sequence of nodes from the root to a leaf

What is a binary tree?

A tree with exactly two children at each internal node

In binary trees, how are the children of a node ordered?

Left child, then right child

What is the distinguishing feature of a complete binary tree?

Every level is completely filled except possibly for the last level, which is filled from left to right

What is the traversal pattern where the root node is visited first?

Pre-order

What does the degree of a node in a binary tree refer to?

The number of children nodes the node has

How is the height of a node in a binary tree defined?

The number of edges on the longest path from the node to a leaf

Study Notes

Tree Terminology

  • A tree is a binary tree if each node has a maximum of two children.
  • Root: a node without a parent.
  • Internal node: a node with at least one child.
  • External node (leaf): a node without children.
  • Ancestors of a node: parent, grandparent, grand-grandparent, etc.
  • Depth of a node: the number of ancestors.
  • Height of a tree: the maximum depth of any node.
  • Descendant of a node: child, grandchild, grand-grandchild, etc.
  • Sibling nodes: children of the same parent.
  • Path: an ordered list of nodes connected by edges.

Key Terms

  • Degree of a node: the number of children of that node.
  • Degree of a tree: the maximum degree of nodes in a given tree.
  • Height of a node: the maximum path length from that node to a leaf node.
  • Height of a tree: the height of the root.

Binary Trees

  • A binary tree is a finite set of nodes that is either empty or consists of a root and two disjoint binary trees called the left subtree and the right subtree.
  • Each internal node has at most two children (exactly two for proper binary trees).
  • The children of a node are an ordered pair, called the left child and right child.

Tree Traversals

  • There are three commonly used patterns to visit all the nodes in a tree: pre-order, in-order, and post-order.
  • Pre-order traversal: visit the root node first, then recursively do a pre-order traversal of the left subtree, followed by a recursive pre-order traversal of the right subtree.

Test your understanding of tree structures with questions on tree height and depth, node degrees, internal and external nodes, and levels in a tree. Identify the root nodes, parent-child relationships, and leaf nodes in the tree diagram provided.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Data Structures Lecture 8: Trees
9 questions
Binary Search Tree Deletion
30 questions
Use Quizgecko on...
Browser
Browser