you don't give enough information on what you're doing to elicit a really useful answer.
One typical way of dealing with unordered hash entries is to maintain separately another data structure that keeps the right order.
For example, you could sort your data only once and store in a separate hash the rank of each value (with the vertex or vertex ref as a key and the rank as value). But we don't have enough information on what you do to know if this would be usable or useful in your case.
As for the complexity,, it's even more difficult to say anything without seeing your code. But, no, in general you should not need to mentally unroll Perl code to underlying C to figure out the complexity of your algorithm. But, you need to understand the complexity of the Perl constructs, though. For example, traversing an array with n entries to see if a value is there would have a O(n) complexity. A hash lookup on the same list of entries, on the other hand, would have a complexity of O(1), i.e. the complexity of a hash lookup does not depend on the size of the hash.
In reply to Re: Algorithm Complexity and Determinism of Graph Module
by Laurent_R
in thread Algorithm Complexity and Determinism of Graph Module
by ownlifeful
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |