ABL
Calculating the ABL
DFS-abl(root, depth) {
if (root.isleaf)
return depth * root.frequency;
else {
return DFS-abl(root->left, depth+1) + DFS-abl(root->right, depth + 1);
}
}
DFS-abl(root) {
DFS-abl(root, 0);
}Last updated