liveBook · Manning

Internal node

As explained in Grokking Data Structures

An internal node is a tree node that has at least one child.

An internal node is a tree node with at least one child. Nodes without children are leaves; therefore, every non-leaf node is internal. The root can also be an internal node when it has children. section 11.2

Use these relationships to recognize internal nodes:

  • A parent is an internal node whenever it has one or more children. section 11.2
  • In a binary tree, an internal node has either one or two children, connected through left and right links. section 11.20
  • Each child of an internal node begins a subtree, so internal nodes mark branching points in hierarchical data. section 11.2

Internal nodes in heapify

When an array is viewed as an almost-complete binary tree, leaves already form valid subheaps. Only internal nodes can violate heap properties, so heapify processes those nodes from the lowest level upward and pushes down a violating root. In the example, the internal node at index 3 is fixed first, followed by the node at index 2. section 10.19

How Grokking Data Structures covers it

How deep it goes
Defines internal nodes by their children, contrasts them with leaves, and applies the distinction to binary trees and heapify.
Examples
Uses binary-tree figures, six leaf values, and heapify nodes at array indices 3 and 2.
What it assumes
Builds from nodes, roots, parents, children, leaves, and subtrees before applying the term to binary trees and heaps.
What you can do after
Evaluate tree nodes as leaves or internal nodes and identify which heap nodes may need push-down repair.
How it connects
Connects internal nodes with trees, roots, parents, children, leaves, subtrees, binary trees, and binary heaps.

Also explained in

Compare how 3 books explain internal node →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Data Structures. The section links point to the parts of the book it draws on.