全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Depth, size, height?

又称: depth (of a node) · size (of a tree) · height (of a tree)

Definition 11.4 University Computer Science — Year 1 · 第 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.
在原文中阅读 →