Question

The time complexity of Redis' HDEL is O(N) (where N is the number of fields to be removed). I have a use case where the field must undergo a type conversion for every operation. How would I express the new time complexity? O(N*2)?

Was it helpful?

Solution

The time complexity will be the same: O(N). Big-O notation is not about clock time, but about scalability. See here for an excellent and easy overview.

OTHER TIPS

Complexity will still be O(n).

Take this example:
Algorithm to traversing a linked list of size 'n' is O(n). Traversing it twice is still O(n). Read http://en.wikipedia.org/wiki/Big_O_notation to difference between O notation and Θ notation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top