Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 884347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:44:12+00:00 2026-05-15T12:44:12+00:00

The catch: only comparisons between elements of the list is allowed. For example, suppose

  • 0

The catch: only comparisons between elements of the list is allowed. For example, suppose we have 1,000,000 chess players, and we are assigned the task of finding the best chess player in the group. We can play one chess player against any other chess player. Now, we want to minimize the maximum number of games any player plays.

If player A beats player B, and B beats C, we can assume that A is better than C. What is the smallest n such that no player plays more than n games?

@Carl: This is not homework; it’s actually a subproblem of a larger problem from SPOJ.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:44:12+00:00Added an answer on May 15, 2026 at 12:44 pm

    How do I find the biggest element of a list

    If the list is ordered, then the biggest element is the first (or last) element of the list.

    If the list is not ordered then:

    Element biggest = list.get(0);
    for (Element e : list) {
        if (e.compareWith(biggest) > 0) {
            biggest = e;
        }
    }
    

    For example, suppose we have 1,000,000 chess players, and we are assigned the task of finding the best chess player in the group. Now, we want to minimize the maximum number of games any player plays.

    With the new constraint of the last sentence …

    Answer #1: zero games played. Compare the chess player’s rankings and the one with the best ranking is the objectively best player … according to the ranking.

    Answer #2: at most ceiling(log2(nos_players)) games played per player. A “knock out” / elimination tournament eliminates half the players in each round, so the number of rounds and hence the maximum number of games played by any one player is ceiling(log2(nos_players)).

    The corresponding algorithm is trivially:

    List players = ...
    while (players.size() > 1) {
        List winners = new ArrayList();
        Iterator it = players.iterator();
        while (it.hasNext()) {
            Player p1 = it.next();
            if (it.hasNext()) {
                Player p2 = it.next();
                int result = p1.compareTo(p2);
                if (result < 0) {
                    winners.add(p2);
                } else if (result > 0) {
                    winners.add(p1);
                } else {
                    throw new Exception("draws are impossible in chess");
                }
            } else {
                winners.add(p1); // bye
            }
        }
        players = winners;
    }
    

    (Aside: if you also have a predetermined ranking for the players and the number of players N is at least 2 less than ceiling(log2(N)), you can arrange that the best 2 players get a bye in one round. If the best 2 players meet in the final, then everyone will have played less than ceiling(log2(N)) games … which is an improvement on the solution where the byes are allocated randomly.)

    In reality, answer #2 does not work for the game of chess because it does not take account of the fact that a significant percentage of real chess games are draws; i.e. neither player wins. Indeed, the fact that player A beat player B in one game does not mean A is a better player than B. To determine who is the better of any two players they need to play a number of games and tally the wins and losses. In short, the notion that there is a “better than” relation for chess players is TOTALLY unrealistic.


    Not withstanding the points above, knock-out is NOT a practical way to organize a chess tournament. Everyone will be camped out on the tournament organizer’s desk complaining about having to play games against players much better (or worse) than themselves.

    The way a real chess (or similar) tournament works is that you decide on the number of rounds you want to play first. Then in a “round-robin” tournament, you select the top N players by ranking. and arrange that each player plays each other player. The player with the best win / draw score is the winner, and in the event of a tie you use (say) “sum of opponents scores” as a tie breaker. There are other styles of tournament as well that cater for more players / less rounds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer % is the modulus operator. So this essentially says -… May 16, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer What I use is with UriKind like var resource =… May 16, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer You can use css only: #customError { position: fixed; top:… May 16, 2026 at 10:30 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Say I have an enum, public enum Colours { Red, Blue } The only
i need a Regex to do this ( catch only real words ): Inputstring:
I have a DataGridView bound to a DataSet. I only want a selection of
The Visual Studio compiler does not seem to warn on signed/unsigned assignments, only on
I have a performance problem related to string comparison (in Java). I'm working on
Consider the following function that implements non-blocking access to only the one thread. public
I have a dependency on .NET 2.0 SP2 in my ClickOnce deployed application (the
Say I have a method like this: public void SaveData() { try { foreach
I have read that HttpURLConnection supports persistent connections, so that a connection can be
I want to be able to create users that have a straight up SHA-1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.