Sorted Set

Noun · Development

Definitions

  1. A collection data structure that maintains unique elements ordered by an associated score or comparator, supporting O(log n) insertion, removal, and range queries. Redis's ZSET is the canonical example, implemented via a skiplist and hash table, and widely used for leaderboards, rate limiters, and priority queues.

    In plain English: A collection where each item has a score, and the items are always kept in order by that score, making it easy to find the highest or lowest.

    Example: "The leaderboard is a Redis sorted set keyed by user ID with the score as their points — ZREVRANGE gives us the top 10 instantly."

Related Terms