How to Make trending & most popular algorithm??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to Make trending & most popular algorithm???

I am making a website using php. How can i make a algorithm in which POSTS can go in most popular, trending category based on view and popularity Just like twitter or YouTube . . any link , refrence , tutorial or answer is appreciated. . Thanx

17th Feb 2019, 9:39 AM
Suraj kushwaha
Suraj kushwaha - avatar
3 Answers
+ 4
This question covers functional design in the first place. It is entirely up to you how you define those categories. What is the measure of popularity? Number of views? Number of likes? Number of comments? Similarly, how do you measure if something is trending? Maybe the number of times viewed within a certain time limit, but that could be a month, a week, a day, an hour? Are these categories mutually exclusive, or can a post be popular AND trending at the same time? In any case, you will need to store these statistical data about the posts, in a database, and determine the ranking or category based on that.
17th Feb 2019, 10:12 AM
Tibor Santa
Tibor Santa - avatar
+ 2
I think popularity is already based on viewamount so I recommend you to just count this amount and then make a method to disblay the video at the top with the highest countvalue. I dont think that you will need any complex algorithms :)
17th Feb 2019, 10:13 AM
avatarluca
avatarluca - avatar
+ 2
Tibor Santa . . Thanx for ans🙂.
17th Feb 2019, 10:31 AM
Suraj kushwaha
Suraj kushwaha - avatar