in reply to Re: Adding Special Rules to Sort
in thread Adding Special Rules to Sort

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.

Replies are listed 'Best First'.
Re^3: Adding Special Rules to Sort
by zentara (Cardinal) on Feb 28, 2009 at 17:14 UTC
    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.

        Contrary to your claim that "he can figure it out", my experience of interviewing candidates says that most can't.

        That's exactly why I said I would do it for a fee. It's real work correctly doing that sort of mathematical modelling.

        I note that your "transitive closure" method does not include a complete solution either.

        I also defend an alternative method of properly setting up hash keys (maybe AoA as values?) and doing the conventional cascading hash sort, including a subsort on the AoA's.

        It also begs questions like does point difference matter in the wins? Or is it just a binary value. etc. etc.

        So I may have flunked your interview......but that's because I'm more creative, or at least differently trained than you.

        No offense.... but your transitive sort dosn't really lead to a general purpose solution, and there is no saying whether your transitive method is the best. I admit you are one of the few who have attempted a solution to the team rankings problem.


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