in reply to Re: Re: Hash of Arrays - Sort over all array entries
in thread Hash of Arrays - Sort over all array entries

This method reduces the number of times through loops

The number of loops is usually less important than how they are nested. 5 loops, none of them nested means run-time on the order of O(5*$n) which is O($n). You had three of your loops nested which is more like O($n**3).

In this case, the loop sizes are more like $n (number of families), $m (number of members per family), and $n*$m (total number of members) so we go from O( ($n*$m)**2 ) to just O($n*$m).

                - tye
  • Comment on Re^3: Hash of Arrays - Sort over all array entries (nesting)