|
LrangeCommand
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
► Sign in to add a comment
|
Search
|
|
LrangeCommand
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
"LRANGE key start end Time complexity: O(n) (with n being the length of the range)"
However, LINDEX is also O(n), with n being the length of the list. How??
@dhruvbird These lists are linked lists. So asking for element i (LINDEX with index i) in the list requires a traversal of i items from the start of the list. This means in worst case, you ask for the next-to-last element in the list, which takes time n-1, or O(n).
I believe dhruvbird's point is that LINDEX can't be O(length of the list) while LRANGE is O(length of the range)... LRANGE must also be O(length of the list).
Hi team, isn't it good to support multi-value insersion operation (similar to LRANGE returning multi-value)? Is there specific reason not to have this which could very helpfull in DB initiation?