What .NET dictionary supports a “find nearest key” operation?

后端 未结 8 739
[愿得一人]
[愿得一人] 2020-12-18 23:08

I\'m converting some C++ code to C# and it calls std::map::lower_bound(k) to find an entry in the map whose key is equal to or greater than k. However, I don\'t see any way

8条回答
  •  忘掉有多难
    2020-12-18 23:47

    I think there's a mistake in the question about SortedList complexity.

    SortedList has O(log(n)) amortized complexity for inserting new item. If you know in advance the capacity it can be done in O(Log(n)) in the worst case.

提交回复
热议问题