E
E
Evgeny Samsonov2015-09-26 16:19:04
PHP
Evgeny Samsonov, 2015-09-26 16:19:04

How to solve the problem about leaders and outsiders?

Take a random sport.
In the database, we have plate No. 1 with the following structure:
Team Win Loss
Team_1 8 18
Team_2 2 9
Team_3 10 2
Team_4 5 8
Team_N 9 10
And plate No. 2, the structure is as follows:
Home match Away match Date
Team_1 Team_2 12/19/2005
Team_3 Team_4 20.12 .2005
Team_N Team_M 12/30/2005
Commands are naturally repeated and can be both in the first column and in the second.
And now the problem. You need to find on which day the strongest team plays with the weakest.
In this setting, everything seems to just find the strongest and weakest and check 2 options:
Weak_Team - Strong_Team
Strong_Team - Weak_Team
But what if we need to find, for example, the 10 strongest and 10 weakest teams and find them in the schedule?
Is there an optimal algorithm? Or do you need to brute force everything against everyone?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evgeny Samsonov, 2015-09-26
@kentastik

If anyone is interested in how I solved.
I took the first table and attached 2 columns to it in which I wrote down whether the team is a loser or a favorite.
Home match Away match Date Winner Loser
If the Winner and Loser columns were both equal, then a match has been found.

M
microphone, 2015-09-26
@microphone

10 strongest ,1 strongest team and the strongest 9 of those who will remain after the first run of the algorithm circle (excluding the one that has already become the strongest) or not?

E
Eugene, 2015-09-27
@n1ger

How cool, but now it has become fashionable, I created a question - I answered it myself, and put it as a solution =) Why ask if you yourself know the answer?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question