This project simulates a sports fest tournament involving up to 128 players, where the goal is to determine the Winner and Runner-up efficiently with the minimum number of comparisons. The implementation demonstrates the use of Divide and Conquer principles for tournament-style winner selection and contrasts it with an Iterative Scan approach for identifying the runner-up.
The problem closely models real-world sports elimination tournaments, where players compete in successive rounds until the top two are determined.
- Implement a Divide and Conquer approach to find the winner.
- Identify the Runner-up (second highest score) efficiently without replaying matches.
- Count and display the number of comparisons made.
- Compare recursive (Divide and Conquer) and iterative methods for performance insights.
Simulates tournament-style elimination rounds using the Divide and Conquer approach, where players are recursively divided into subgroups until one winner remains.
After finding the winner, determine the runner-up (second best) without rerunning the entire process. The algorithm tracks and compares only relevant candidates.
Provides an opportunity to analyze and compare both approaches in terms of number of comparisons and computational efficiency.
-
Language: C
-
Maximum Players: 128
-
Core Functions:
findWinner()— Uses recursion (Divide and Conquer) to determine the highest score.findRunnerUp()— Determines the second highest score, either via iterative scan or recursive refinement.
-
Global Counter: Tracks total number of comparisons for analysis.
8
90 78 95 79 91 87 92 89
Winner Score : 95
Runner-up Score : 92
Total Comparisons: 14
- The Divide and Conquer approach mimics tournament elimination, reducing redundant comparisons.
- The Iterative Scan method is simpler but can increase the total number of comparisons.
- By analyzing both, students learn how recursive problem-solving can lead to efficiency improvements.