Ranking algorithm using likes / dislikes and average views per day
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.
In the digital world, algorithms play a pivotal role in determining the visibility and ranking of content across platforms like YouTube, Instagram, and Facebook. Among the myriad ranking algorithms, a model that employs likes, dislikes, and average views per day provides an insightful approach to gauging content quality and engagement. This article delves into the intricacies of such an algorithm, exploring its mechanisms, advantages, and potential challenges.
Understanding the Basic `Parameters`
Likes and Dislikes
Likes and dislikes are straightforward metrics that signify user engagement and sentiment towards a piece of content. In an algorithm, the net engagement can be calculated as:
While likes indicate positive responses, dislikes serve as a feedback mechanism, curbing over-rewarding low-quality or misleading content. However, it's crucial to balance likes with dislikes to avoid extreme polarization.
Average Views Per Day
This metric gives insight into the ongoing popularity and relevance of content. It is calculated as:
A high average views per day suggests that new audiences are continually finding value in the content, potentially through recommendations or search discoverability.
Combining Metrics for Ranking
To develop a comprehensive ranking score, these parameters can be integrated into a weighted formula:
Here, and are scaling factors that ensure each component's impact aligns with platform goals. Normalization of views per day is necessary to map different content types (e.g., videos, posts) into comparable metrics.
Normalizing Views Per Day
To ensure comparability:
Where is the minimum and is the maximum average views per day observed within a certain timeframe.
Implementing the Algorithm
Example Walkthrough
Imagine three pieces of content, A, B, and C, with the following statistics:
| Content ID | Likes | Dislikes | Total Views | Days Since Upload |
| A | 1000 | 100 | 50000 | 10 |
| B | 1500 | 50 | 60000 | 15 |
| C | 500 | 20 | 30000 | 5 |
Step-by-Step Calculation
- Net Engagement:• A: • B: • C:
- Average Views Per Day:• A: • B: • C:
- Normalization (assuming max VPD = 6000 and min VPD = 4000):• A: • B: • C:
- Ranking `Score` Calculation:
Assuming weights and :
• A: • B: • C:
Based on the ranking scores, content B ranks highest, followed by A, then C.
Advantages and Challenges
Advantages
• Balanced View: Integrating likes, dislikes, and views considers multiple facets of content performance. • Dynamic Scaling: Normalization allows for flexible application across diverse content genres and types.
Challenges
• Gaming the System: Users might attempt to manipulate rankings through artificial inflations of likes or views. • Short-Lived Trends: Viral but short-lived content might skew average views per day, affecting long-term visibility unfairly.
Conclusion
A ranking algorithm utilizing likes, dislikes, and average views per day provides a nuanced view into content performance. By balancing user engagement with content reach, such an algorithm can accurately predict and enhance content visibility. However, continual monitoring and adjustments are necessary to ensure fairness and resilience against manipulation.
Related reading

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.