Write function pathLength() for the abstract tree class AbstractTree that returns the sum of the depths of
Fantastic news! We've Found the answer you've been seeking!
Question:
Write function pathLength() for the abstract tree class AbstractTree that returns the sum of the depths of all positions in T. The implementation should be linear-time in runtime. Briefly state your algorithm.
You should make use of existing functions as much as possible. You can also define a private helper function if necessary.
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date: