Returns the total number of leaves under this node.
| 106 | |
| 107 | // Returns the total number of leaves under this node. |
| 108 | unsigned Interior::leafCount() const { |
| 109 | unsigned count = 0; |
| 110 | auto c = childAtIndex(0); |
| 111 | for (unsigned n = childCount(); n > 0; --n, ++c) { |
| 112 | if (c->isLeaf()) |
| 113 | count += 1; |
| 114 | else |
| 115 | count += ((Interior*)c)->leafCount(); |
| 116 | } |
| 117 | return count; |
| 118 | } |
| 119 | |
| 120 | void Interior::dump(std::ostream &out, unsigned indent =1) const { |
| 121 | unsigned n = childCount(); |