2026-05-12 | algorithms | #integer-compression #inverted-index #varint #zigzag #golomb-rice #elias-fano #pfordelta #fastpfor #stream-vbyte #simd-bp128 #lucene
以倒排表的 d-gap 为对象,在两份真实语料和伯努利合成表上实测 varint、Elias、Golomb/Rice、插值编码、Elias-Fano、Simple、PFOR、Stream VByte、BP128 的每整数比特数与下界之差,并在共享 2 vCPU 上测解码的相对速度。
2026-05-13 | algorithms · database | #time-series #gorilla #delta-of-delta #xor-compression #chimp #alp #prometheus #influxdb #victoriametrics
拆解 Gorilla 的时间戳 delta-of-delta 与浮点 XOR 编码,对照 Prometheus、InfluxDB、VictoriaMetrics 钉版本源码,用节点采集数据和 ALP 数据集实测每个值花多少比特,并说明 XOR 在十进制数据上失效的原因与 Chimp、Elf、ALP 的改法。
2026-05-14 | algorithms · database | #columnar #parquet #orc #dictionary-encoding #rle #bit-packing #delta-encoding #btrblocks #duckdb #arrow
对照 Parquet 2.11 规范与 Arrow、ORC 源码拆开字典、RLE/位打包混合、DELTA 与 RLEv2,讲清写入器何时放弃字典;在 TPC-H lineitem 上按字节比较 Parquet、ORC 与级联选择,并数出在编码数据上执行省下的工作。
2026-05-23 | algorithms | #bwt #fm-index #lf-mapping #backward-search #bzip2 #bwa #wavelet-tree #suffix-array
BWT 只是可逆排列,LF 映射让它能还原文本、用 rank 查询计数子串。本文用对拍过的 C 实现推演逆变换、backward search 与采样 SA 定位,并对照 bzip2 1.0.8、BWA 0.7.18 源码说明工程取舍。
2026-05-08 | algorithms | #huffman #deflate #canonical-huffman #package-merge #zlib #zopfli #gzip #rfc1951 #entropy-coding
证明 Huffman 码为何最优、离熵多远,讲清规范码、15 位限长、查表解码与 DEFLATE 的三层码表;用逐比特记账的解码器拆开 zlib 1.3 与 zopfli 的输出:Huffman 只比经验熵多 0.64%,距离额外比特却占 42%。
2026-05-09 | algorithms | #lz77 #lz78 #lzw #lzss #match-finder #hash-chain #binary-tree #optimal-parsing #compress #gif #zlib #xz
从 1977、1978 年两篇原始论文出发,讲清滑动窗口与短语表两种字典、LZSS 与 LZW 的改动;用可解码验证的固定码 DEFLATE 输出实测哈希链与二叉树匹配查找器、贪心/lazy/最优解析:二叉树每位置 22 个候选即得最长匹配,最优解析比贪心小 12.7%。
2026-05-10 | algorithms | #zstd #rfc8878 #fse #tans #huffman #dictionary-compression #long-distance-matching #lz77 #entropy-coding
按 RFC 8878 与 zstd 1.5.7 源码拆开帧、块、字面量段和序列段,讲清 FSE 表怎么建、怎么传、编码器怎么选模式;用逐比特记账的解码器实测:偏移额外比特占 39–44%,FSE 离逐块经验熵不到 1%,字典与长距离匹配的收益取决于数据和编码器的启发式。
2026-05-11 | algorithms | #arithmetic-coding #range-coder #ans #rans #tans #fse #lzma #entropy-coding
算术编码、range coder、rANS、tANS 怎样让每个符号只花分数比特,有限精度的损失落在频率量化、区间截断、状态下界、表的排布和收尾字节中的哪一处;用逐比特记账的可复现实验量化离熵多远,并讨论自适应建模、专利与 tANS 建表的开放问题。
2026-04-22 | algorithms | #algorithms #sorting #hashing #simd #compiler #data-structures
汇总本站算法工程相关文章,覆盖排序、哈希、树、字符串、近似数据结构、SIMD、随机化与编译器相关算法。
2026-04-16 | algorithms | #concurrent-hashmap #java #split-ordered-list #lock-free #sync-map #rhashtable #concurrency
对照 JDK 7/25 的 ConcurrentHashMap、NonBlockingHashMap、Linux rhashtable 与 Go sync.Map 的源码,说明并发哈希表真正难的是扩容;实测桶长分布、扩容克隆比例与树化条件,并给出通过 TSan 的分裂有序表实现。
2026-04-16 | algorithms | #mpmc #channel #go-channel #crossbeam-channel #rte_ring #disruptor #lost-wakeup #concurrency
对照 Go 1.25、crossbeam-channel、DPDK v25.11 源码,拆解有界 channel 的一把锁、逐槽 stamp、两阶段预留三种环与直接交接、通知重试两种唤醒;实测线程停顿、丢失唤醒、公平性与 TSan 报告。
2026-04-15 | algorithms | #rcu #linux-kernel #liburcu #membarrier #memory-reclamation #concurrency #grace-period
从宽限期保证的形式陈述出发,对照 liburcu 0.15.7 与 Linux v6.12 源码,说明读侧省掉的 StoreLoad 栅栏由谁补上、'读侧零开销'在哪些配置下成立;实测读侧开销、宽限期延迟、membarrier IPI 转嫁给读者的代价和一个缺栅栏的变异体。
2025-07-15 | algorithms | #lock-free #treiber-stack #aba #cmpxchg16b #exponential-backoff #elimination-backoff #llist #boost-lockfree
Treiber 栈只靠一次 CAS,却要分别处理 ABA、内存回收和争用三件事。本文用确定性复现、守恒测试和 sanitizer 区分前两者,在 4 个逻辑 CPU 上实测指数退避与消除数组,并对照 Linux llist、Windows SList、Boost.Lockfree 的取舍。
2026-04-14 | algorithms | #hazard-pointers #memory-reclamation #lock-free #concurrency #smr #membarrier #c++26 #folly
按 Michael(TPDS 2004)的条件拆解 hazard pointers:发布后为何要复读、StoreLoad 栅栏防哪种重排、未回收节点的上界从哪来;实测两个变异体、x86 store buffering 和每个指针的开销,对照 Folly、C++26 与乐观遍历之争。
2026-04-15 | algorithms | #epoch-based-reclamation #crossbeam #memory-reclamation #lock-free #concurrency #rust #smr
从 Fraser(2004)的三个 limbo list 出发,推导 EBR 为什么要等两个纪元、垃圾该打哪个纪元的标签;对照 crossbeam-epoch 0.9.18 源码,实测两个变异体、pin 的指令选择、每节点开销、回收速率上限,以及一个被抢占或睡住的读者让垃圾涨到多少。
2026-05-07 | algorithms · network | #aqm #bufferbloat #red #codel #fq-codel #pie #l4s #dualpi2 #sch_fq_codel #rfc8289 #rfc8290 #rfc7567 #linux-kernel
瓶颈队列何时丢包、丢谁的包:对照 RFC 与 Linux v6.12 源码核对 RED、CoDel、FQ-CoDel、PIE 的规则与默认值,用包级离散事件模拟比较四种队列的延迟、吞吐与短流完成时间,并梳理 FQ 与 L4S DualQ 之争。
2026-05-06 | algorithms · network | #routing #distance-vector #link-state #path-vector #ospf #is-is #bgp #mrai #route-flap-damping #stable-paths-problem #lfa #ti-lfa #sdn
在同一 8 节点拓扑上模拟距离向量、链路状态、路径向量在链路故障和目的地失效后的收敛轮数与消息数,对照 RFC 2328、RFC 4271 与 Labovitz、Griffin 等论文,解释 LSA 泛洪、MRAI、路由震荡抑制、策略不收敛和快速重路由各自解决什么、代价是什么。
2026-04-13 | algorithms | #lock-free #michael-scott-queue #aba-problem #linearizability #c11-memory-model #threadsanitizer #lcrq
按 PODC 1996 原文复原 Michael-Scott 无锁队列:线性化点、计数指针防 ABA、计数器为何不解决内存回收、每条 CAS 的 C11 内存序,并用 TSan 与线性化检查器实测。
2026-04-14 | algorithms | #skip-list #lock-free #harris-list #lazy-skiplist #ConcurrentSkipListMap #jdk21 #leveldb #rocksdb #linearizability #threadsanitizer
跳表插删要改多个指针,靠标记删除或乐观加锁把它们变成一次线性化操作。对照 Pugh、Harris、Fraser、HLLS 与 JDK 21、LevelDB、RocksDB 源码,并用 TSan 与对拍验证实现,实测独占 CPU 与超额订阅两种情形下的吞吐。
2026-05-05 | algorithms · distributed | #load-balancing #power-of-two-choices #p2c #join-shortest-queue #smooth-weighted-round-robin #peak-ewma #nginx #envoy #grpc #prequal
从球箱模型与超市模型出发,用离散事件模拟比较随机、轮询、P2C、JSQ 在新鲜与过时负载信息下的平均与 p99 逗留时间,再对照 NGINX 1.26.2、Envoy v1.31.0、gRPC、Finagle 与 Prequal 说明各策略的真实实现与适用边界。
2026-05-02 | algorithms | #tcp #congestion-control #reno #newreno #cubic #bbr #aimd #rfc5681 #rfc9438 #linux-kernel
按 RFC 5681、RFC 9438、BBR 草案与 Linux 源码核对 Reno、CUBIC、BBR 的窗口规则,用包级离散事件模拟复现锯齿、缓冲区排队和 BBR 与 CUBIC 抢带宽的条件,并梳理 BBRv3 的标准化状态与公平性争论。
2026-04-29 | algorithms · database | #lsm-tree #compaction #leveling #tiering #lazy-leveling #rocksdb #universal-compaction #bloom-filter #monkey #write-stall
拆解 leveling、tiering、lazy leveling 的代价模型,对照 RocksDB 9.7.4 的 leveled、universal、FIFO 源码,用计数模拟器实测 22 种配置的写、读、空间放大,并验证 Monkey 给小层更多 filter 位。
2026-04-30 | algorithms · database | #mvcc #snapshot-isolation #ssi #write-skew #postgresql #innodb #percolator #tikv #hekaton #version-chain
按 Wu 等人(VLDB 2017)的设计维度对照 PostgreSQL 17、InnoDB 8.4、Oracle、SQL Server、Hekaton 与 TiKV 的 MVCC;用模拟器验证三种可见性写法等价、测量 SSI 误杀,并在 PostgreSQL 上复现写偏斜。
2026-05-01 | algorithms · database | #learned-index #rmi #pgm-index #fiting-tree #radixspline #alex #lipp #piecewise-linear-approximation #sosd #b-tree
把有序数组查找看成拟合 CDF:梳理 RMI 到 PGM-index、ALEX、LIPP 的谱系,用可复现程序在四种分布上比较比较次数、缓存行与索引大小,并对照 SOSD、GRE 基准:学习索引在只读、易拟合数据上领先,写密集、难分布与并发下优势收窄。
2026-05-04 | algorithms · distributed | #rate-limiting #token-bucket #leaky-bucket #gcra #nginx-limit-req #redis-cell #envoy #guava-ratelimiter #rfc2697 #rfc2698
同一段突发流量喂给窗口计数、令牌桶、漏桶与 GCRA:按 ATM Forum TM 4.0 与 Network Calculus 证明令牌桶与 GCRA 等价,再用 NGINX、redis-cell、Envoy、Guava 的源码移植与实测核对参数映射、突发上限和排队延迟。
2026-05-03 | algorithms · network | #sliding-window #flow-control #arq #go-back-n #selective-repeat #tcp #sack #window-scaling #nagle #delayed-ack #quic #http2 #linux
从停等、GBN、SR 的效率推导与丢包模拟出发,说明窗口为何要覆盖 BDP、SR 为何只能用一半序号空间,再按 RFC 9293、RFC 9000、RFC 9113 与 Linux 6.12 源码拆解 TCP、HTTP/2、QUIC 的接收窗口与自动调优。
2026-04-27 | algorithms · database | #buffer-pool #lru-k #2q #clock-pro #postgresql #innodb #page-replacement
从数据库缓冲池的 fix/unfix、脏页和扫描污染出发,对照 LRU-K、2Q、CLOCK-Pro 的学术脉络,以及 PostgreSQL 16 与 InnoDB 8.0 的源码实现,用可复现 trace 比较命中率和元数据开销。
2025-07-15 | algorithms | #sorting #timsort #powersort #merge-sort #galloping #cpython #openjdk #adaptive-sorting
对照 CPython 与 OpenJDK 源码拆解 TimSort 的 run 检测、minrun、galloping 与合并,梳理 2015 年栈不变量 bug 和改用 Powersort 的原因;比较次数来自与 CPython 逐次一致的 C 移植。
2025-07-15 | algorithms | #sorting #pdqsort #introsort #quicksort #blockquicksort #heapsort #rust #go #libcxx #boost-sort
对照 orlp/pdqsort 源码与 Peters 论文,拆解 pdqsort 在 introsort 上的四处改动;用与参考实现比较次数逐次一致的 C 移植和 McIlroy 对抗输入实测,并梳理 Boost、Rust、Go、libc++ 各自采用了哪些部分。
2025-07-15 | algorithms | #radix-sort #counting-sort #lsd-radix-sort #american-flag-sort #ska-sort #ips2ra #cache #tlb #ieee-754-totalorder
比较下界只约束比较模型,基数排序把代价转移到键长和内存访问上。本文推导代价模型,用缓存模拟与绑核实测解释位宽为何停在 8 到 11 位,并对照 ska_sort、ClickHouse、DuckDB 与 IPS²Ra 说明它何时赢、何时输。
2025-07-15 | algorithms | #sorting #parallel #sorting-network #bitonic-sort #merge-path #sample-sort #work-span #radix-sort #cub #rayon #onetbb #libstdc++
用 work/span 计数解释并行排序为何难以线性加速:串行归并与串行划分把并行度压在个位数,并行归并、Merge Path 与样本排序各自如何突破;再对照 libstdc++、oneTBB、Rayon、CUB 源码看生产实现的真实选择。
2025-07-15 | algorithms | #cuckoo-hashing #hash-table #cuckoo-graph #stash #load-threshold #bfs #memc3 #libcuckoo #dpdk-rte-hash #ovs-cmap #cuckoo-filter
从 Pagh–Rodler 的两表插入与 cuckoo 图出发,用可复现实验核对失败概率、stash、d-ary 与分桶的负载阈值和两种插入搜索的代价,再对照 MemC3、libcuckoo、DPDK、OVS 源码说明并发读写怎样避免假未命中。
2026-04-07 | algorithms | #swiss-table #open-addressing #simd #swar #abseil #flat-hash-map #hashbrown #go-map #tombstone
对照 Abseil 20260817.0、Go 1.26.8 与 hashbrown 0.17.1 源码,拆解 Swiss table 的控制字节编码、SIMD/SWAR 分组匹配、三角探测、删除与 rehash 策略,并用可复现实验测量探测长度、墓碑代价与每元素内存。
2026-06-12 | algorithms | #lr-parsing #lalr #yacc #bison #compiler #grammar
LR 解析是编译器前端最重要的算法,没有之一。
2026-06-14 | algorithms | #register-allocation #graph-coloring #linear-scan #compiler #llvm #jit
寄存器分配是编译器后端对程序性能影响最大的优化。
2026-04-09 | algorithms | #consistent-hashing #virtual-nodes #rendezvous-hashing #jump-hash #multi-probe #maglev #bounded-load #envoy #cassandra #dynamo
用可复现模拟量化虚拟节点数与负载偏差(相对标准差约 1/√V),对比环、HRW、Jump、Multi-probe、Maglev 的均衡与迁移代价,并对照 Envoy、Cassandra、nginx 源码说明默认参数的真实含义。
2026-04-10 | algorithms | #bloom-filter #counting-bloom #blocked-bloom #quotient-filter #cuckoo-filter #xor-filter #binary-fuse-filter #ribbon-filter #rocksdb #leveldb #amq
用可复现实验测量 Bloom、分块 Bloom、cuckoo、xor 与 Ribbon 的每键位数和误判率,对照 log2(1/ε) 下界解释 1.44 倍从何而来、经典 FPR 公式偏在哪里,并核对 RocksDB 9.10 的 FastLocalBloom 与 Ribbon 实现。
2025-07-15 | algorithms | #xxhash #xxh3 #wyhash #simd #avx2 #sse2 #neon #umac #mum #hash-function
对照 xxHash v0.8.3 与 wyhash final4 源码拆解两者的内层循环,用逐位一致的复现程序和 i9-12900K 实测说明:AVX2 版 XXH3 在缓存内领先,默认 SSE2 构建反而慢于 wyhash,两者都有已知的乘零多重碰撞。
2025-07-15 | algorithms | #red-black-tree #avl-tree #llrb #wavl #2-3-4-tree #tree-rotation #linux-rbtree #augmented-rbtree #rb-root-cached #maple-tree
用可复现的计数实验(红黑树部分与 Linux v6.12 lib/rbtree.c 逐操作一致)比较 AVL、红黑树与左倾红黑树的树高、旋转、平衡标记写入和比较次数:AVL 与红黑树平均差距很小,差在删除的最坏情形;并核对内核从 AVL 换到红黑树、再把 VMA 交给 maple tree 的史实。
2026-04-18 | algorithms · database | #b-tree #b-plus-tree #bbolt #boltdb #page-split #fill-factor #copy-on-write #b-link-tree #postgresql-nbtree #sqlite
从 Bayer-McCreight 1972 推导树高与分裂摊还代价,用计数模拟器和 bbolt v1.5.0 实测:随机插入页填充约 69%,按键序插入由分裂点决定是 50% 还是近 100%;再对照 bbolt、PostgreSQL、SQLite 源码看删除、写时复制与 B-link 并发。
2026-04-19 | algorithms · database | #b-plus-tree #lsm-tree #write-amplification #space-amplification #rum-conjecture #leveldb #rocksdb #innodb #bloom-filter
从 O'Neil 1996 与 Dostoevsky 的代价模型推导两类结构的读写空间放大,用计数模拟器在同一负载上实测:B+tree 写放大随缓冲池从 126 降到 8.6,leveled LSM 为 14.4,并对照 RUM 猜想原文与生产数据。
2026-04-23 | algorithms | #veb-tree #predecessor-search #word-ram #y-fast-trie #hierarchical-bitmap #cell-probe-lower-bound #linux-scheduler
vEB 树把 w 位整数键逐层对半拆分,使前驱查询每层只递归一次,代价是与宇宙大小成正比的空间。本文给出经穷举测试的 C 实现,用调用次数、字节数和绑核计时对比 std::set 与 64 叉分层位图,并梳理从 1975 年原论文到 Pătraşcu–Thorup 下界的谱系。
2026-04-24 | algorithms · cryptography | #merkle-tree #authenticated-data-structure #rfc9162 #certificate-transparency #consistency-proof #sparse-merkle-tree #merkle-patricia-trie #verkle-tree #cve-2012-2459 #git
按 RFC 9162 实现 Merkle 树哈希、包含证明与一致性证明并用公开向量验证,复现域分离缺失与 Bitcoin CVE-2012-2459 两类缺陷,实测 k 叉 trie 证明大小,梳理从 Merkle 1979 到 Verkle 与二叉状态树之争。
2026-05-21 | algorithms | #suffix-array #prefix-doubling #sa-is #induced-sorting #lcp-array #kasai #enhanced-suffix-array #libsais #libdivsufsort
后缀数组用 4n 字节代替后缀树。本文用对拍过的 C 实现推演倍增、SA-IS 与 Kasai LCP,统计三种二分搜索的字符比较次数,并与 libdivsufsort、libsais 实测构造时间和工作内存。
2026-05-22 | algorithms | #aho-corasick #string-matching #multi-pattern #trie #failure-function #dfa #snort #hyperscan
从 Aho–Corasick 原文出发讲清 goto、失败与输出函数、2n 转移界和输出爆炸,用可复现程序对比满表 DFA、稀疏 NFA、位图 NFA、字节类 DFA 的内存与扫描代价,并核对 grep、Snort、Suricata、Hyperscan 与 Rust crate 的实际选择。
2026-05-24 | algorithms | #edit-distance #levenshtein #damerau-levenshtein #osa #wagner-fischer #myers-bit-vector #ukkonen #levenshtein-automaton #bk-tree #symspell #lucene #seth
从 Wagner-Fischer 填表出发,讲清带状 DP、Myers 位并行、OSA 与真 Damerau 的区别,用可复现程序在 8 万词词典上对比 BK-tree、Trie 自动机与对称删除,并核对 Lucene、git 的实际实现与 SETH 下界。
2026-05-25 | algorithms | #rabin-karp #rolling-hash #polynomial-hash #rabin-fingerprint #thue-morse #buzhash #gear-hash #content-defined-chunking #fastcdc #rsync #restic #borgbackup
滚动哈希的保证来自输入确定后才随机选的素数、基或不可约多项式。本文按 Karp-Rabin 原文推导碰撞界,实测 Thue-Morse 串攻破 2^64 自然溢出,并用 LBFS、FastCDC、restic、borg 的源码与模拟说明内容定义分块。
2025-07-15 | algorithms · database | #hyperloglog #cardinality-estimation #loglog #flajolet-martin #hyperloglog-plus-plus #linear-counting #redis #pfcount #sketch #streaming
12 KB 的 HyperLogLog 误差从哪来:沿 FM85、LogLog、HLL、HLL++ 到 Ertl 估计器推导,用 1000 次模拟实测各代估计器在小、中、大基数上的偏差,并对照 Redis 7.2.5 源码拆解稀疏/密集编码和三次更换的估计公式。
2025-07-15 | algorithms | #count-min-sketch #count-sketch #conservative-update #count-mean-min #streaming #frequency-estimation #redisbloom #caffeine #datasketches
Count-Min Sketch 的误差是 εN 的加性界而非相对误差。本文核对原论文定理条件,用 Zipf 实验比较标准更新、保守更新、count-mean-min 与 Count Sketch,并对照 RedisBloom、DataSketches、Caffeine 源码。
2025-07-15 | algorithms · observability | #t-digest #quantile #sketch #scale-function #kll #ddsketch #reqsketch #elasticsearch #clickhouse #prometheus
t-digest 用缩放函数限制质心大小,换来极小的尾部秩误差,但没有最坏情形保证。本文对照 Dunning 与 Ertl 预印本及 Elasticsearch、ClickHouse 源码,用可复现实验测量尾部误差与合并顺序的影响,并复现让误差达到约 40% 的困难分布。
2025-07-15 | algorithms | #reservoir-sampling #algorithm-r #algorithm-l #vitter-algorithm-z #weighted-sampling #a-res #bottom-k #postgresql-analyze #spark #sliding-window
水塘抽样要保证的是每个 k 子集等概率。本文严格证明 Algorithm R,从随机键推出 Li 的 Algorithm L,用卡方检验与随机数计数对比 R、L 与 Vitter Z,核对 PostgreSQL 17 与 Spark 3.5 源码,并讨论加权键、样本合并与滑动窗口。
2025-07-15 | algorithms | #minhash #simhash #jaccard #cosine-similarity #near-duplicate-detection #banding #b-bit-minhash #one-permutation-hashing #datasketch
从 Broder 的 shingling 与 min-wise 哈希、Charikar 的随机超平面出发,实测 MinHash 估计误差、banding 的 S 曲线和 SimHash 汉明阈值对应的余弦区间,对照 Manku 2007 的置换表与 datasketch 2.0.0 的实现。
2025-07-15 | algorithms | #heavy-hitter #misra-gries #space-saving #lossy-counting #stream-summary #frequent-items #datasketches #mergeable-summaries
m 个计数器能把流中频率估到多准?核对 Misra-Gries、Lossy Counting、Space-Saving 的定理与两种下界,证明 MG 与 SS 同构,用 Zipf 流实测 top-100 召回与误差,对照 DataSketches、ClickHouse、RedisBloom 源码。
2025-07-15 | algorithms | #streaming #sketch #frequency-moments #ams-sketch #turnstile #communication-complexity #linear-sketch #mergeable-summaries #lower-bound
一遍扫描、内存远小于数据时能算什么:梳理三种流模型、Morris 到 AMS 与 Indyk 的谱系、通信复杂度下界,实测 AMS F2 sketch 误差随计数器数的变化,说明线性 sketch 为何可合并、可删除,并把本系列 30 到 35 篇串成路线图。
2026-05-28 | algorithms | #kd-tree #nearest-neighbor #range-search #spatial-index #curse-of-dimensionality #sliding-midpoint #scipy #nanoflann #flann
用分步图讲 kd-tree 构建、回溯剪枝和 √n 范围查询,核对主流库实现,并用可复现实验说明维度增长、内在维度与近似搜索的边界。
2026-05-30 | algorithms | #hnsw #vector-search #approximate-nearest-neighbor #nsw #relative-neighborhood-graph #hnswlib #faiss #lucene #pgvector
从 NSW 到 HNSW,拆解随机层数、SEARCH-LAYER、启发式邻居选择与参数边界;对照 hnswlib、Faiss、Lucene、pgvector 源码默认值,并用可复现实验比较 simple 与 heuristic 邻居选择的召回成本。
2026-05-31 | algorithms | #product-quantization #ivf #pq #faiss #vector-search #compression
从 Jégou 等人的 PQ/ADC 到 Faiss v1.8.0 的 IVF-PQ 源码,用可复现实验解释码长、量化误差、nprobe 与候选数如何共同决定召回。
2026-06-03 | algorithms | #dijkstra #a-star #shortest-path #priority-queue #pathfinding #contraction-hierarchies
从 Dijkstra 的 label-setting 不变式出发,解释负权反例、A* 的可采纳与一致启发式、reduced cost 等价关系,并用可复现 C 程序按扩展节点、出堆、松弛与 decrease-key 次数比较实现取舍。
2026-06-05 | algorithms | #mst #kruskal #prim #boruvka #union-find #cut-property #fibonacci-heap #karger-klein-tarjan #chazelle
从允许并列边的割性质与环性质出发,给出 Kruskal、Prim、Borůvka 的正确性条件与分步图,用可复现程序按比较次数、decrease-key 次数和计时对比三者,并梳理从 1926 年到 Chazelle、Pettie–Ramachandran 的谱系与确定性线性时间开放问题。
2026-06-06 | algorithms | #tarjan #scc #articulation-point #bridge #lowlink #dfs #graph
从 DFS 的 discovery/low-link 不变量出发,区分有向 SCC 与无向割点、桥的 low 值定义,用可复现实验核对递归、迭代、Kosaraju 与暴力基线,并说明重边、栈深度和生产实现中的常见边界。
2026-06-07 | algorithms | #network-flow #max-flow #min-cut #bipartite-matching #edmonds-karp #dinic #push-relabel #hopcroft-karp
从残量图与最小割证书出发,核对 Ford-Fulkerson、Edmonds-Karp、Dinic、push-relabel 与 Hopcroft-Karp 的复杂度、反例、生产实现和可复现实验。
2025-07-15 | algorithms · os | #cpu-scheduling #cfs #eevdf #linux-kernel #vruntime #sched-ext
从比例份额调度的论文谱系出发,对照 Linux v6.6 与 v6.12 fair.c 源码,解释 CFS 的 vruntime、EEVDF 的 lag/eligible/deadline,并用确定性模拟复现延迟与 lag 的差异。
2025-07-15 | algorithms · os | #io-scheduler #blk-mq #mq-deadline #bfq #kyber #nvme #linux-kernel
从电梯算法到 blk-mq,解释 Linux I/O 调度器为何在 HDD 上排序、在共享设备上保公平、在 NVMe 上常选择 none,并用确定性模拟展示寻道距离与队列尾延迟的取舍。
2026-04-06 | algorithms · linux | #epoll #eventpoll #linux-kernel #red-black-tree #wait-queue #epollexclusive #thundering-herd #io-multiplexing
对照 Linux 6.12 fs/eventpoll.c 拆解 epoll 的红黑树兴趣表、rdllist 与 ovflist、ep_poll_callback 和读写锁,并用可复现实验检验 LT/ET 语义、EPOLLEXCLUSIVE 的适用场景与 poll/epoll 开销。
2026-04-25 | algorithms · database | #join #nested-loop-join #sort-merge-join #hash-join #hybrid-hash-join #radix-join #postgresql #mysql #query-processing
用页 I/O 模拟器按 Shapiro 1986 与 DeWitt 1984 的代价模型对比嵌套循环、排序归并、Grace 与 hybrid hash,再对照 PostgreSQL 17、MySQL 8.4 源码看溢出与倾斜怎么处理,并复现内存中分区与不分区之争。
2026-06-04 | algorithms · network | #bellman-ford #shortest-path #negative-cycle #spfa #rip #distance-vector #bgp #babel #eigrp #ospf
从 Bellman-Ford 的松弛不变式和负环提取出发,用可复现 C 程序与距离向量模拟器解释 RIP 的 count-to-infinity、split horizon 的边界,以及 Babel、EIGRP、BGP、OSPF 对环路问题的不同取舍。
2026-04-06 | algorithms · os | #memory-allocator #jemalloc #tcmalloc #mimalloc #fragmentation #systems-programming
从 Wilson 分配器综述到 jemalloc、gperftools tcmalloc 与 mimalloc 的源码路径,解释 size class、线程缓存、跨线程释放和 RSS 碎片;用可复现实验说明不能只凭 allocator 名字下结论。
2026-04-06 | algorithms · os | #buddy-system #slub #slab #linux-kernel #page-allocator #kmalloc #fragmentation
以 Linux v6.6 源码和确定性模拟为准,解释伙伴系统的 split/coalesce、migratetype 反碎片策略,以及 SLUB 的 per-CPU freelist、partial list 与安全加固。
2025-07-15 | algorithms · storage | #filesystem #ext4 #htree #btrfs #xfs #b-tree #extent-tree #copy-on-write #linux-kernel
从 Linux v6.6 的 ext4 extent/HTree、btrfs CoW B-tree 与 XFS B+tree 源码出发,用确定性模拟量化 extent 元数据和 CoW 路径复制的写放大。
2026-04-06 | algorithms · linux | #timer #timing-wheel #min-heap #hrtimer #linux-kernel #go-runtime #netty #kafka
从 Varghese-Lauck 时间轮到 Linux、Go、Netty、Kafka 源码,比较堆、红黑树、简单轮和层级轮在插入、取消、级联与到期误差上的真实边界。
2026-04-26 | algorithms · database | #query-optimizer #system-r #volcano #cascades #cardinality-estimation #cost-model #postgresql #calcite #dpccp
从 System R 的左深动态规划与 interesting orders 出发,解释 Volcano/Cascades 如何用 memo、规则和物理性质组织搜索,再用可复现实验展示查询图形状与基数估计误差如何决定计划质量。
2026-04-28 | algorithms · database | #wal #aries #crash-recovery #checkpoint #postgresql #sqlite #database
从 steal/no-force 缓冲策略出发,拆解 ARIES 的 Analysis、Redo、Undo、pageLSN、CLR 与 fuzzy checkpoint,并用可复现实验验证恢复中再次崩溃的幂等性;最后对照 PostgreSQL 16 与 SQLite 3.46 的真实 WAL 边界。
2025-07-15 | algorithms · os | #page-replacement #lru #clock #2q #arc #clock-pro #workingset #kswapd #direct-reclaim #mglru
从 Bélády OPT 与栈算法出发,用可复现的模拟实验对比 FIFO、LRU、CLOCK、2Q、ARC 在循环与扫描负载下的命中率,再对照 Linux 6.12 源码说明 active/inactive、workingset 与 kswapd/direct reclaim 的真实分工。
2026-06-10 | algorithms · compiler | #graph-coloring #register-allocation #dsatur #chaitin-briggs #llvm #gcc #ssa
从图着色模型、DSatur 与弦图特例出发,解释寄存器分配中的干涉图、乐观着色、合并与溢出,并用可复现实验和 LLVM/GCC 源码钉住工程边界。
2026-06-01 | algorithms | #scann #diskann #vamana #vector-search #avq #product-quantization #ssd #ann
从 ScaNN 的 score-aware 各向异性量化到 DiskANN 的 Vamana 图与 SSD beam search,核对论文公式、开源参数和可复现实验,说明内存量化与磁盘图检索各自解决什么问题。
2026-06-02 | algorithms · database | #vector-search #ann #segment #filtered-search #mmap #compaction #hnsw
不重复 HNSW、PQ 和 DiskANN 细节,而是把向量检索放回引擎层:段式存储、墓碑删除、过滤搜索、mmap、并发快照与可复现召回评测。
2026-06-08 | algorithms | #topological-sort #dag #dependency #kahn #graphlib #ninja #go #incremental-algorithms
从线性扩展定义出发,用 Kahn、DFS、字典序堆和增量维护解释依赖解析;以 CPython graphlib、Ninja 与 Go cmd/go 源码钉住工程边界,并用可复现实验统计访问边数、队列操作和插边重排规模。
2026-06-09 | algorithms | #pagerank #random-walk #markov-chain #personalized-pagerank #networkx #graphx
从随机游走和 Google 矩阵出发,核对 PageRank 原始论文的公式尺度、悬挂节点处理、收敛速度、生产实现差异,并用可复现实验比较幂迭代、Gauss-Seidel、局部 push 与 Monte Carlo。
2026-05-29 | algorithms | #lsh #locality-sensitive-hashing #approximate-nearest-neighbor #vector-search #random-hyperplane #p-stable #multi-probe #falconn #ann-benchmarks
从 (c,r)-ANN 与 LSH 的 rho 参数出发,推导 AND-OR 放大、随机超平面、p-stable 与 multi-probe,复现实测 SIFT1M 上召回率和候选数,并说明为什么理论保证不等于工程排名。
2026-05-27 | algorithms | #unicode #utf-8 #utf-8-validation #simd #dfa #normalization #grapheme-cluster #case-folding #bidi #trojan-source
UTF-8 的位布局、合法序列与最大子部分替换,Hoehrmann DFA 与 Keiser–Lemire SIMD 验证,再到规范化、字素簇、大小写折叠和 Trojan Source;编解码器经全部 2^32 个四字节串穷举测试。
2026-05-26 | algorithms | #simd #avx2 #sse4.2 #pcmpistri #memchr #strlen #glibc #simdjson #csv #pclmulqdq #prefix-xor #addresssanitizer
对照 glibc AVX2 汇编与 simdjson 源码,用对拍、守护页和 ASan 验证向量化字节扫描的越界读,在 i9-12900K 上实测 memchr、PCMPISTRI 与 CSV/JSON 引号掩码:L1 内快约 39 倍,到内存只剩约 5.7 倍,JSON 的瓶颈在下标提取。
2026-04-20 | algorithms | #treap #skip-list #randomized-bst #cartesian-tree #split-merge #redis-zset #leveldb #rocksdb #backward-analysis
用 Seidel–Aragon 的祖先引理和 Pugh 的逆向分析推导 Treap 深度、旋转次数与跳表查找路径,逐项用计数实验核对;对照 Redis、LevelDB、RocksDB、JDK 源码核对 p 与层数上限,并讨论对手看得见随机性时的退化。
2025-07-15 | algorithms · database | #external-sort #io-model #replacement-selection #loser-tree #polyphase-merge #postgresql #tuplesort #gnu-sort #coreutils
从 Aggarwal–Vitter 的 I/O 下界出发,用可复现实验比较替换选择与快排生成 run、败者树与堆的比较次数、多阶段与平衡归并的搬运量,再对照 PostgreSQL 18 与 GNU sort 9.11 源码说明今天为何多用快排、平衡归并和堆。
2025-07-15 | algorithms | #sorting #benchmark #introsort #pdqsort #timsort #radix-sort #branch-prediction #libstdc++
在 GCC 16 上对 9 种 int32 排序做精确比较计数与绑核计时(8 种输入分布、3 个进程取中位数):比较次数预测不了耗时,分支预测与输入结构决定排名;反复排序同一数组会把小数组耗时低估 2 到 6 倍。
2025-07-15 | algorithms | #hash-table #open-addressing #linear-probing #robin-hood #tombstone #swiss-table #cpython-dict #java-hashmap #go-map
用可复现的探测次数模拟核对 Knuth 的线性探测公式,比较链式、线性探测、Robin Hood、双重哈希与 SwissTable 分组探测的探测分布和删除策略,再对照 CPython 3.13、JDK 21、Go 1.23/1.24、Abseil、Redis 7.4 的源码说明各自的取舍。
2026-04-08 | algorithms | #perfect-hashing #mphf #fks #bdz #chd #pthash #recsplit #gperf #hypergraph-peeling
静态键集合上的零冲突哈希有两种目标:FKS 存键、最坏两次访存;MPHF 不存键、下界约 1.443 bits/key。本文用可复现实验核对 FKS、BDZ 剥离、hash-and-displace 与 gperf 3.3 的真实做法。
2026-05-16 | algorithms · cryptography | #miller-rabin #primality-test #strong-pseudoprime #baillie-psw #aks #openssl #fips-186-5 #rsa-keygen #carmichael
用可复现实验核对 Miller-Rabin 的 1/4 界、平均情况误判率和 64 位确定性底数,梳理 BPSW 与 AKS 的谱系,并对照 OpenSSL 3.6.2 源码与 FIPS 186-5 说明 RSA 素数实际做几轮测试、为什么够用。
2025-07-15 | algorithms · cryptography | #hash-function #siphash #hash-flooding #merkle-damgard #length-extension #sponge #sha-3 #blake3 #avalanche #smhasher #murmurhash3 #abseil
区分非密码学哈希、带密钥 PRF 与密码学哈希三种契约;用可复现实验演示 SHA-256 长度扩展、雪崩测试的局限、DJBX33A 与带种子 MurmurHash3 的哈希洪泛,并对照 CPython、Rust、Go、Abseil 源码说明各自默认哈希。
2026-04-21 | algorithms | #fenwick-tree #binary-indexed-tree #segment-tree #lazy-propagation #zkw-segment-tree #prefix-sum #cell-probe
从 Ryabko/Fenwick 的累积频率表和 Bentley 的区间结构讲起,推导树状数组区间修改、线段树规范分解与懒标记不变量,用对拍、访问计数和绑核计时比较递归、zkw 与树状数组。
2026-04-22 | algorithms | #persistent-data-structure #path-copying #node-copying #fat-node #hamt #champ #rrb-tree #clojure #scala #okasaki #git
保留全部历史版本要多少代价?从 DSST 1989 的胖节点、节点复制出发,对照路径复制、Okasaki 的惰性队列、Clojure/Scala 的 32 路 trie、HAMT/CHAMP 与 Git 对象模型,用可复现程序测量每次更新复制的节点和字节。
2025-07-15 | algorithms | #algorithms #string-matching #kmp #boyer-moore #bm-algorithm #pattern-matching
KMP、Boyer-Moore(BM 算法)字符串匹配:暴力法对比、失配函数、Sunday 变体与工程性能——字符串匹配算法选型必读。
2026-06-12 | algorithms | #string-matching #kmp #boyer-moore #rabin-karp #aho-corasick #simd #pattern-matching #index
字符串匹配算法工程选型:KMP、Boyer-Moore(BM)、Rabin-Karp、AC 自动机、后缀数组、SIMD 与模糊匹配——按场景选算法,附本站深度文章导航。
2026-04-10 | algorithms | #sorting #index #performance #series
把 TimSort、pdqsort、radix sort、external sort、parallel sort 与 benchmark 串成一条阅读路径。先读哪篇、什么时候选哪种排序,这一页讲清。
2026-05-20 | algorithms | #elliptic-curve #ecc #ecdsa #group-theory #curve25519 #number-theory
椭圆曲线密码学的数学核心,比你想象的更优雅。
2025-07-15 | algorithms | #geometry #point-location #trapezoidal-decomposition #randomized
给定一个被线段划分的平面,如何快速确定一个查询点落在哪个区域?梯形分解用随机增量法构建 O(log n) 查询的优雅结构。
2025-07-15 | algorithms | #dp #viterbi #ad-pacing #reinforcement-learning #industry
动态规划不只是算法竞赛的工具。从广告预算分配到 GPS 轨迹匹配,DP 的思想在工业系统中以各种形式默默运行着。
2025-07-15 | algorithms | #randomized #karger #schwartz-zippel #monte-carlo #las-vegas
随机化不是偷懒,而是一种强大的算法设计范式。从 Karger 最小割到 Schwartz-Zippel 引理,随机性让许多困难问题变得出人意料地简单。
2025-07-15 | algorithms | #geometry #sweep-line #bentley-ottmann #segment-tree
扫描线是计算几何中最通用的算法范式——用一条虚拟的线从左到右扫过平面,将二维问题降维为一维动态问题。
2025-07-15 | algorithms | #data-structures #algorithms #persistent-data-structures #functional-programming #version-control
持久化数据结构原理与实现:探索 undo/redo、MVCC、Git 等系统背后的数据结构设计模式
2025-07-15 | algorithms | #algorithms #binary-search #search-algorithms #data-structures #C
二分查找算法详解:原理、实现、变种及常见错误分析,O(log n) 时间复杂度的高效搜索算法
2025-07-15 | algorithms | #algorithms #heavy-hitters #streaming-algorithms #data-mining #big-data
Heavy Hitters 算法:如何高效计算高频数据项,在流式数据处理和热门页面统计中的应用
2025-07-15 | algorithms | #cpp #json #parser #state-machine #compiler
从零开始实现一个基于有限状态机(FSM)的 JSON 解析器,不依赖第三方库,顺手吃透词法分析与语法分析的基础。
2025-07-15 | algorithms | #regex #performance #redos #security #optimization
深入探讨正则表达式回溯导致的性能问题,拆解 ReDoS 攻击原理、防御策略与真实排查案例。
2025-07-15 | algorithms | #regex #regular-expressions #pattern-matching #automata #compiler
从乔姆斯基层级、Thompson 构造到 NFA/DFA 与代码实现,系统理解正则表达式背后的理论与工程。
2025-11-13 | algorithms | #simd #sse2 #avx2 #avx-512 #string-algorithms #performance-optimization #vectorization #intrinsics #strchr #strstr #parallel-computing
面向工程实践的SIMD字符串查找优化完全指南:SSE2/AVX2/AVX-512并行比较原理,位掩码技巧,跨块与页边界安全处理,strchr/strstr高性能实现,包含完整代码示例和性能陷阱分析
2026-05-17 | algorithms | #euclidean #gcd #modular-inverse #crt #rsa #number-theory
一个两千年前的算法,仍然是现代密码学的基石。
2026-05-18 | algorithms | #lll #lattice #post-quantum #svp #cryptanalysis #number-theory
LLL 算法是密码分析中最强大的工具之一。
2026-05-19 | algorithms | #finite-field #galois #aes #reed-solomon #gf256 #number-theory
有限域是密码学和纠错编码共同的数学基础。
2026-06-11 | algorithms | #dfa #minimization #hopcroft #lexer #regex #compiler
每个正则表达式引擎背后,都有一个 DFA 最小化算法在工作。
2026-06-13 | algorithms | #peg #packrat #parsing #memoization #compiler #pest
PEG 用确定性选择解决了 CFG 的歧义问题,但代价是什么?
2025-07-15 | algorithms | #compiler #ssa #dominance-tree #optimization #llvm
SSA 是现代编译器 IR 的核心表示形式。从支配树到 φ 函数,理解 SSA 的构造和优化是深入编译器的必经之路。
2025-07-15 | algorithms | #gc #garbage-collection #concurrent #jvm #go-runtime
从引用计数到并发三色标记,从分代假说到 ZGC 的亚毫秒暂停。垃圾回收是编程语言运行时中最复杂也最精妙的子系统。
2025-07-15 | algorithms | #cache-oblivious #memory-hierarchy #veb-layout #performance
缓存无关算法不需要知道缓存的大小和行宽,却能自动在所有缓存层级上达到最优性能。这个优美的理论模型对实践有多大指导意义?
2025-07-15 | algorithms | #branchless #performance #cpu-pipeline #simd #optimization
现代 CPU 的分支预测器已经非常精准,但当预测失败时代价高昂。无分支编程用算术和位运算消除条件跳转,在特定场景下带来数倍加速。
2025-07-15 | algorithms | #simd #vectorization #avx #performance #patterns
SIMD 不只是'把标量操作变成向量操作'那么简单。从 SoA 布局到 pshufb 查表,掌握这些设计模式才能真正释放向量化的威力。
2025-07-15 | algorithms | #online-algorithms #competitive-analysis #ski-rental #paging #k-server
当你必须在信息不完整时做出不可撤销的决策,最坏情况下能做到多好?竞争分析给出了在线算法性能的严格数学框架。
2025-07-15 | algorithms | #geometry #convex-hull #graham-scan #chan-algorithm
从 Graham Scan 的极角排序到 Chan 算法的 output-sensitive 最优性,凸包问题展示了计算几何算法设计的精妙思维。
2025-07-15 | algorithms | #geometry #voronoi #delaunay #triangulation
Voronoi 图和 Delaunay 三角剖分是计算几何中最优美的对偶结构。从最近邻查询到有限元网格生成,它们的应用无处不在。
2025-07-15 | algorithms | #geometry #r-tree #spatial-index #postgis #gis
地理信息系统如何在数百万个多边形中快速找到附近的餐厅?R-tree 用层级化的边界矩形将空间搜索从暴力扫描变为对数级查询。
2025-07-15 | algorithms | #geometry #closest-pair #randomized #divide-and-conquer
在 n 个点中找最近的一对,暴力需要 O(n^2)。分治法将其优化到 O(n log n),而 Rabin 的随机化方法更进一步达到期望 O(n)。
2025-07-15 | algorithms | #dp #tree-dp #rerooting #virtual-tree #centroid-decomposition
树形 DP 是动态规划中最优美的分支之一。换根技巧将复杂度从 O(n^2) 降到 O(n),虚树将多次查询的总复杂度压缩到关键点规模。
2025-07-15 | algorithms | #dp #bitmask #tsp #subset-sum #combinatorics
当问题的状态空间是集合的幂集时,位运算提供了优雅的压缩表示。从 TSP 到 SOS,状压 DP 是处理 NP-hard 问题精确解的核心武器。
2025-07-15 | algorithms | #dp #convex-hull-trick #slope-optimization #li-chao-tree
当 DP 转移方程可以写成线性形式,凸包技巧将 O(n^2) 优化到 O(n log n) 甚至 O(n)。这是竞赛和工业优化中最强大的 DP 加速手段之一。
2025-07-15 | algorithms | #dp #divide-and-conquer #quadrangle-inequality #knuth-optimization
当 DP 的最优决策点具有单调性时,分治技巧可以将 O(n^2) 优化到 O(n log n)。四边形不等式是识别这种结构的关键数学工具。
2025-07-15 | algorithms | #dp #interval-dp #matrix-chain #optimal-bst
区间 DP 是处理'在区间上做最优决策'问题的通用框架。从矩阵链乘到 RNA 折叠,它的应用远比教科书展示的更广泛。
2026-05-15 | algorithms | #fft #polynomial #signal-processing #ntt #convolution
FFT 是 20 世纪最重要的算法之一,没有之一。
2025-11-29 | algorithms | #regex #visualization #nfa #javascript #interactive
通过交互式动画,直观演示非确定性有限自动机(NFA)匹配字符串的步进过程,揭示正则引擎的内部奥秘。