in reply to (Golf) Dependency List Prioritization
The thing that I do differently than previous solutions is add a step where I follow dependencies. Since the longest chain of dependencies is cannot be longer than the number of elements, I just need to repeat that step the right number of times.sub f{ #23456789_123456789_123456789_123456789_123456789_123456789_123456789_ +123456789_123456789_123456789_123456789_123456789_123456789_123 %h=@_;$h{$_}||=[]for map@$_,values%h;for(@k=keys%h){for$x(@k){push@{$h +{$x}},@{$h{$_}}for@{$h{$x}}}}sort{-1+2*grep$_ eq$b,@{$h{$a}}}@k }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: (Golf) Dependency List Prioritization
by tadman (Prior) on Mar 15, 2002 at 19:09 UTC |