全部书籍

专业

应用 关于 Coach 登录 开始阅读

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

Computer Science · 术语表

什么是 Tree of activations?

又称: call tree

Definition 3.5 University Computer Science — Year 1 · 第 3 章 — Functions and the Call Stack

The tree of activations (or call tree) of a run has one node per call; the children of a node are the calls made directly by that call, in order. Its root is the first call, its leaves the calls that made no call. The number of calls is the number of nodes; the greatest number of frames on the stack at once is the height of the tree, counted in nodes.

The tree of activations of binom(4, 2), nodes labelled (n, k), leaves shaded. Thick outlines: the four frames on the stack when the call binom(1, 1) of the right subtree runs, which is a path from the root. The run makes 11 calls, the number of nodes, but needs at most 4 frames, the height.
The tree of activations of binom(4, 2), nodes labelled (n,k)(n, k), leaves shaded. Thick outlines: the four frames on the stack when the call binom(1, 1) of the right subtree runs, which is a path from the root. The run makes 11 calls, the number of nodes, but needs at most 4 frames, the height.
在原文中阅读 →