Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Depth, size, height?

Ook bekend als: depth (of a node) · size (of a tree) · height (of a tree)

Definition 11.4 University Computer Science — Year 1 · Hoofdstuk 11 — Induction, Recursion and Termination

The depth of a node is the number of links from the root to it. The size of a binary tree is its number of nodes, 0 for the empty tree. Its height is the largest depth of its nodes, and −1-1 for the empty tree: by induction, h(empty)=−1h(\text{empty}) = -1 and h((ℓ,k,r))=1+max⁡(h(ℓ),h(r))h((\ell, k, r)) = 1 + \max(h(\ell), h(r)).

The two rules that generate binary trees, and what they produce from trees of height at most 0 (the empty tree, dashed, and the single node). Height -1, 0, 1, 1 and 1; the last tree is full.
The two rules that generate binary trees, and what they produce from trees of height at most 0 (the empty tree, dashed, and the single node). Height −1-1, 0, 1, 1 and 1; the last tree is full.
Lees in het hoofdstuk →