Phango - questions

Christopher Wright dhasenan at gmail.com
Tue Nov 20 11:16:11 PST 2007


Matti Niemenmaa wrote:
> 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.

You're saying that having fewer large modules is a direct consequence of 
having a flat structure and having many modules is a direct consequence 
of having a hierarchical structure. I disagree with that.

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



More information about the Digitalmars-d mailing list