dotnet / dotnet/dotnet-api-docs

Question about Time Complexity

Open
#1,274 3 comments 1 reaction 0 assignees View on GitHub
area-System.Collections dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

@EngineerSpock commented on [Tue Dec 04 2018](https://github.com/dotnet/dotnet-api-docs.ru-ru/issues/4)

It seems that the time complexity of Clear in the SortedSet is O(1) as well as in case of the SortedDictionary while documentation says it is linear. I found the following code of the Clear method in the SortedSet:

public virtual void Clear() {
root = null;
count = 0;
++version;
}

---
#### Сведения о документе

⚠ *Не вносите правки в этот раздел. Это необходимо для связывания страницы сайта docs.microsoft.com с вопросом на GitHub.*

* ID: b4c066df-fd39-5f78-bd28-dd74ec6daf7d
* Version Independent ID: e2e77322-dde1-bcf7-03d6-5017f0b28819
* Content: [SortedSet<T>.Clear Method (System.Collections.Generic)](https://docs.microsoft.com/ru-ru/dotnet/api/system.collections.generic.sortedset-1.clear?view=netframework-4.7.2)
* Content Source: [xml/System.Collections.Generic/SortedSet`1.xml](https://github.com/dotnet/dotnet-api-docs.ru-ru/blob/live/xml/System.Collections.Generic/SortedSet`1.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.