P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
While this too is an option to solve the problem at hand, you will find that over time and with larger sets of data, that this method will prove to be substantially slower. This is due to the fact that a grep or loop over all set elements will, in a worst-case scenario, occur with O(n) execution - In contrast, a hash-lookup operates with O(1) execution.
As such this approach, particularly with larger data sets, can be justified, trading memory space for execution speed.
In reply to Re: Re: best data structure
by rob_au
|
|