Sno*_*man 8 algorithm twitter pseudocode
我正在尝试设计一个类似于Twitter时间轴的系统,但我无法理解如何在保持高效的同时从众多粉丝那里获得更新.假设我在推特上关注了1000人.当我转到我的Feed时,它如何知道哪些推文给我看?这就是我的想法,但它似乎非常低效且不太可能:
You have 10,000 friends.
In a for loop, loop through each friend, getting their latest
status updates since their last update.
Run Code Online (Sandbox Code Playgroud)
但是,通过10,000个朋友循环似乎是荒谬的.我无法想象他们会怎么做呢.或者它会是这样的:
Someone I am following posted a tweet. That tweet is inserted in
an array containing the tweets of all people I am following.
Run Code Online (Sandbox Code Playgroud)
但后来这看起来很奇怪,如果我跟随一个有2万条推文的新人,那么我的阵列中会插入20,000条推文,如果那个人拥有数百万的粉丝,那么同一套推文就有一百万个X 20,000个拷贝.所以这似乎也不太可能.
任何人都有任何想法,他们怎么可能这样做?