Phango - questions

Matti Niemenmaa see_signature at for.real.address
Tue Nov 20 08:22:24 PST 2007


Christopher Wright wrote:
> Also, this hierarchical documentation could be as simple as "if you want
> to accomplish this task, you should look at this module", and then it's
> O(1) to get to the file in the flat structure, not O(log n) as with the
> hierarchical one.

Ah, but consider the task of finding the right part of the module. :-)

For the flat structure, it's O(l) where l is the length of the file.

For the hierarchical structure, it's O(L + d) where L is the length of the right
file in the hierarchy and d is the depth of the hierarchy.

Taking L as the average length of a file in the hierarchical structure, it's l/n
where n is the total number of modules into which the l-length module has been
split. Thus the hierarchical one is O(l/n + d) where d is O(n), so it comes down
to O(l) versus O(l/n + n), of which the former grows faster.

And of course, you still need to find the documentation first, too... ;-)

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list