Jump to content

Need help with algorithm for this case please.


hoomey

Recommended Posts

Please someone write this algorithm in Python please.

 

Divide and conquer

N runners participate in a 100-meter sprinting competition. All runners are seeded from number 1 to number n. After all the running heats are over, the competition results are determined by comparing the time. The sprinter with the fastest time is ranked 1st and the sprinter with the slowest time ranked nth.
Write an algorithm that computes the number of sprinter pairs that have the competition results opposite to the pairs’ seed numbers.
The running time of the algorithm must be O(nlgn).
Input: list of seed numbers according to the sprinter results, from the fastest to the slowest.
Output: the number of sprinter pairs that get the results opposite to the seeding.
Edited by hoomey
Link to comment
Share on other sites

!

Moderator Note

 

 

moved to Homework Help by Moderator

 

 

Homework Help Rules

 

A simple reminder to all: this is the "Homework Help" forum, not the "Homework Answers" forum. We will not do your work for you, only point you in the right direction. Posts that do give the answers may be removed.

 

So Hoomey would you explain where you have got to in solving this problem and what has stopped your progress - hopefully members can then help you to overcome your difficulties yourself.

 

Link to comment
Share on other sites

Mr. imatfaal, would it be easier/faster if i just ping you when i see stuff like this, that needs to be moved?

 

Just report the post and say you think it is in the wrong forum - then all moderators will see the report and eventually one of them will put down their cocktail for a moment, take a look, and perhaps move the thread.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.