Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Tree of activations?

Também chamado de: call tree

Definition 3.5 University Computer Science — Year 1 · Capítulo 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.
Ler no capítulo →