Topological Sort

1 Definition In computer science, a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertx v, u comes before v in the ordering. It sounds pretty academic, but I am sure you are using topological sort unconsciously every single day. 2 Application Many real world situations can be modeled as a graph with directed edges where some events must occur before others....

五月 22, 2022 · 5 分钟 · 874 字 · Ramsay Leung

关于分布式系统唯一ID的探究

最近我需要为运行的分布式系统某部分模块构造系统唯一的ID, 而 ID 需要是数字的形式,并应该尽量的短。不得不说,这是一个有趣的问题 1 若干实现策略 查...

五月 23, 2017 · 3 分钟 · 1476 字 · Ramsay Leung

爬虫高效去重之布隆过滤器

笔者最近思考如何编写高效的爬虫; 而在编写高效爬虫的时候,有一个必需解决的问题就是: url 的去重,即如何判别 url 是否已经被爬取,如果被爬取,那就不要...

四月 9, 2017 · 3 分钟 · 1324 字 · Ramsay Leung

归并排序算法改进

最近笔者在阅读《算法》,重温经典数据结构和算法,毕竟一直以来的说法是程序就是数据结构+算法归并算法所需的时间和N*logN成正比,所以可以用...

三月 1, 2017 · 3 分钟 · 1251 字 · Ramsay Leung