Code Fragment: diskSpace



int diskSpace(const Tree& T, const Position& v) {
  int s = size(v);          				// start with size of v
  PositionIterator children = T.children(v);
  while (children.hasNext())
    s += diskSpace(T, children.next());			// add weights of subtrees
  if (T.isInternal(v))
    cout << name(v) << ": " << s << endl;		// print name and weight
  return s;
}