This project implements an efficient algorithm to compare multiple ranking lists against a reference ranking using merge sort and inversion counting. It measures how similar each ranking source is to the reference by counting how many pairs of elements are out of order.
The project demonstrates:
- Divide-and-conquer algorithms
- Efficient inversion counting using merge sort
- Real-world data processing with large datasets
- Modular and algorithmic problem solving
- Merge Sort
- Inversion Counting
- Divide and Conquer Strategy
Ranking-algorithm/ ├── main.py ├── CS-3364.ipynb ├── source1.txt ├── source2.txt ├── source3.txt ├── source4.txt ├── source5.txt
The program uses five text files, each representing a ranking list from a different source:
source1.txtsource2.txtsource3.txtsource4.txtsource5.txt
Each file contains a list of ranked items (IDs and optionally scores).
1.Check with: python3 --version
2.Install dependency This project uses pandas for pretty table output: python3 -m pip install pandas
3.Run the program From inside the project folder: python3 main.py
The program prints a table with the following columns: Source File Overlap (number of common items with reference) Inversions (number of out-of-order pairs) Max Inversions (maximum possible inversions) Reliability (similarity score between 0 and 1)
This project was developed as part of a university algorithms course and demonstrates efficient handling of large datasets (~10,000 elements per file) using O(n log n) algorithms. Course: CS 3364 — Design and Analysis of Algorithms Topic: Divide and Conquer, Inversion Counting, Algorithmic Analysi