最近更新
Diameter of Tree
Definition of diameter In a given tree, the diameter is defined as the longest path between any two nodes. For instance, the diameter of th…
分类浏览
最近更新
Definition of diameter In a given tree, the diameter is defined as the longest path between any two nodes. For instance, the diameter of th…
2024-05-29
Timer on ProcessFunction and KeyedProcessFunction Flink distinguishes between two key notions of time: processing time and event time. Proc…
2024-05-26
Stream API (SourceFunction, AbstractSourceFunction and RichSourceFunction) in Flink In Flink’s streaming API, there is a critical interface…
2024-04-01
Manhattan Distance Definition: The Manhattan distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ in a 2D plane is defined as $dis = |…
2023-12-16
Why Dynamic Segment Tree? As know for segment tree, the space complexity is is up to 4 n, which n is upper bound of data range. However, :-…
2022-07-11
前言 Goroutine是Golang中实现的协程,它保证了Golang的高并发的可用性,这些Goroutine分配、负载、调度到处理器上采用的是G-M-P模型。 进程、线程、Goroutine 进程是操作系统进行资源分配调度的最小单元,而线程则是CPU进行调度的最小单元。进程…
2022-05-31
引言 Covey在书中用一个小例子描述了“个人看法的重要性”,他儿子在学校的表现不尽人意,做父母的经常鼓励孩子,然而却是于事无补,随着Covey对儿子的看法转变,即便是不刻意鼓励孩子,他也能飞快的进步。也即引出了书中最为重要的观点:“为了达成真正的改变,必须对自我认知做出改变,…
2022-01-25
Timeline & Search 简介 系统设计中,时间线(timeline)功能是十分常见的,诸如朋友圈,微博,Twitter等社交平台都会涉及到,主要功能就是按时间线看到已经关注的人发送的消息。而搜索功能则是公开社交平台的重要功能。 Pull vs. Push 为了实现时…
2022-01-24
给定一个公共API,限制每个用户每秒只能调用1000次,如何实现?这个一个经典的API限速问题(API rate limiting)。 初始想法 最朴素的想法就是给每一个用户配额,此时为Q,在第一次调用的时候分配给用户,然后在接下来的时间段,如果访问的此时大于Q,就直接拒绝用户…
2022-01-02
雪花算法能解决什么问题? 雪花算法能够生成全局唯一的ID编码作为其他地方的标记。且生成一系列的ID满足如下的性质: 生成的系列ID是递增的 高可用性:任何时候都能够生成唯一的ID 再高并发的条件下也能够保证服务 SnowFlake的组成 最高位是符号位,始终为0 41位的时间戳…