Skip to content

rupeshpandith/Tournament-Winner-Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

🏆 Winner & Runner-up Detection using Divide and Conquer

📘 Project Description

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.


🎯 Objectives

  • 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.

🧩 Use Cases

(a) Winner via Elimination Rounds

Simulates tournament-style elimination rounds using the Divide and Conquer approach, where players are recursively divided into subgroups until one winner remains.

(b) Identify 2nd Best Without Replaying

After finding the winner, determine the runner-up (second best) without rerunning the entire process. The algorithm tracks and compares only relevant candidates.

(c) Compare Divide & Conquer vs Iterative Scan

Provides an opportunity to analyze and compare both approaches in terms of number of comparisons and computational efficiency.


⚙️ Implementation Details

  • 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.


🧠 Example

Input

8
90 78 95 79 91 87 92 89

Output

Winner Score     : 95
Runner-up Score  : 92
Total Comparisons: 14

📊 Insights

  • 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.

About

Finding the Winner and Runner-up among given player scores using the Divide and Conquer approach

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages