in reply to (Golf) Dependency List Prioritization

It is not particularly short, but the following 133 solution at least looks to be a valid solution to the problem:
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 }
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.

Replies are listed 'Best First'.
Re^2: (Golf) Dependency List Prioritization
by tadman (Prior) on Mar 15, 2002 at 19:09 UTC
    When I finally came up with something "workable", I had my doubts about it, though I wasn't sure exactly why. It did work on my test data, both as posted, and as used, though for reasons that must surely be "dumb luck".

    Following the chain is exactly what I was missing out on. Thanks for pointing that out.