Redis Sorted Set 在内部是如何实现的?hash + skip list 的组合分别承担什么作用?Sorted Set 如何进行 tie-break?
How is Redis Sorted Set implemented internally? What roles do hash and skip list play, and how are ties broken?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: hard
分类: redis, data-structures
标签: skip-list, internal-implementation, hash, tie-break, lexicographic
参考答案摘要
TL;DR Redis Sorted Set 内部采用 hash + skip list 的双结构:hash 用于快速定位 member → score ,skip list 用于按 score 排序并支持 O(log(n)) 范围/排名查询。默认情况下,score 相同时会按 member 字符串的 字典序升序(lexicographic ascending) 进行 tie-break。 内部结...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。