Skip to content

Big O notation of SADD and LPUSH #1020

@ghost

Description

I just started making my way through the Redis 15 minute crash course http://redis.io/topics/data-types-intro and noticed that the SADD command http://redis.io/commands/sadd has a time complexity of O(N) where N is the amount of members and LPUSH http://redis.io/commands/lpush has a time complexity of O(1), however LPUSH accepts multiple value arguments.

For consistency purposes shouldn't the time complexity of both be documented as the same (e.g. O(1) per 1 element or O(N) for N elements?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions