Jump to content

Need help with algorithm for this case please.

Featured Replies

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

!

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.

 

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

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.

Archived

This topic is now archived and is closed to further replies.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.