Add to SortedSet<T> and its complexity
Posted
by Andrei Taptunov
on Stack Overflow
See other posts from Stack Overflow
or by Andrei Taptunov
Published on 2010-03-28T13:16:36Z
Indexed on
2010/03/28
13:23 UTC
Read the original article
Hit count: 272
MSDN states the following SortedSet(T).Add Method :
If Count is less than the capacity of the internal array, this method is an O(1) operation.
Could someone please explain "how so"? I mean when adding new value we need to find a correct place to add a value (comparing it with another values) and internal implementation looks like a "Red-Black tree" with O (log N) insertion complexity.
© Stack Overflow or respective owner