Redis: Is ZADD better than O(logN) when the inserted element is at the beginning or end?
The redis documentation for ZADD states the operation is O(log N ). However, does anyone know if ZADD is better than O(log N ) when the inserted element is at the beginning or end of the sort order? E.g. for certain implementations this could be O(1). Specifically, the redis tutorial states that: Sorted sets are implemented via a dual-ported data structure containing both a skip list and an hash table, so every time we add an element Redis performs an O(log( N )) operation. It seems plausible to modify a skip list to support O( k ) insert at beginning and end, where k is the max level of the