5 treeprobs.initJSAV()

How many internal nodes does this tree have?

ANS

Anything that is not a leaf node is an internal node. Internal nodes might have 1 or 2 children.

4

How many leaf nodes does this tree have?

ANS

Anything that has no children is a leaf node.

6

How many nodes in the tree have at least one sibling?

ANS

Siblings must have the same parent. If a node has two children, then each such child has a sibling.

8

How many descendents does the root of this tree have?

ANS

Every node except the root is a descendent.

What is the height of this tree?

3
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 9
  • Trees have depth -- they do not have height
  • None of the above

Count the number of steps to the deepest node, and add 1.

What is the depth of this tree?

Trees have height -- they do not have depth
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 9
  • Trees have height -- they do not have depth
  • None of the above

Nodes have depth.

Which statement is correct?

The tree is neither full nor complete
  • The tree is complete but not full
  • The tree is full but not complete
  • The tree is full and complete

Do any internal nodes have only one child? If so, the tree is not full.

A complete tree fills in nodes level by level, with the bottom level filled in from left to right.