in reply to Adding Special Rules to Sort

See Tricky sorting of HOH.. There is a recipe for stringing together sorts, connected with || and or, to custom sort any HoH. Google for "perl sort HoH". Also look at the tutorial section here, and search for "sort", there are many recipes in there.

I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness

Replies are listed 'Best First'.
Re^2: Adding Special Rules to Sort
by tilly (Archbishop) on Feb 28, 2009 at 16:40 UTC
    How on Earth is this meant to be an answer to the question that is being asked?

    It is clear to me that the OP knows very well how to sort in Perl, and how to do tricky sorts with complex combinations of criteria. The problem is how to do a sort based on the head to head criteria. Your answer does nothing to help with that problem.

      I hate to disagree

      One part to his multipart criteria..... Using the built in sort allows me to do everything I want except deal with criteria 3 correctly. ......i.e. head to head wins

      Now all he has to do is setup a hash key on who won head to head......the most creative way to do this, is up to debate.

      My answer pointed the way to sorting HoH, and yes, I did not specifically give code to do this, but I feel he can figure that much out, or hire someone who can. I will do it for a small fee.n ;-) Proper setup, and reliability testing is not some easy code, as the rest of the nodes show, there are alot of variables.....head to head wins in pre-season, regular season, post season, etc....alot of complications. Not to mention his additional sorting criteria.


      I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness
        Point missed, again.

        The main challenge here is how to set up the head to head criterion while dealing with the prospect of cycles. That is not something that general advice about sorting algorithms is going to be any help with. As my answer makes clear, the key concept you need is that of a transitive closure.

        Contrary to your claim that "he can figure it out", my experience of interviewing candidates says that most can't. Heck, most programmers can't even do a simple breadth first search. And that is when they know exactly what they are supposed to do.