asymptotic-complexity

Asymptotic complexity of .NET collection classes

主宰稳场 提交于 2019-11-26 18:49:36
Are there any resources about the asymptotic complexity (big-O and the rest) of methods of .NET collection classes ( Dictionary<K,V> , List<T> etc...)? I know that the C5 library's documentation includes some information about it ( example ), but I'm interested in standard .NET collections too... (and PowerCollections' information would also be nice). MSDN Lists these: Dictionary<,> List<> SortedList<,> (edit: wrong link; here's the generic version ) SortedDictionary<,> etc. For example: The SortedList(TKey, TValue) generic class is a binary search tree with O(log n) retrieval, where n is the

Throwing cats out of windows

好久不见. 提交于 2019-11-26 18:42:47
问题 Imagine you're in a tall building with a cat. The cat can survive a fall out of a low story window, but will die if thrown from a high floor. How can you figure out the longest drop that the cat can survive, using the least number of attempts? Obviously, if you only have one cat, then you can only search linearly. First throw the cat from the first floor. If it survives, throw it from the second. Eventually, after being thrown from floor f, the cat will die. You then know that floor f-1 was

Difference between Big-O and Little-O Notation

淺唱寂寞╮ 提交于 2019-11-26 09:22:33
What is the difference between Big-O notation O(n) and Little-O notation o(n) ? Tyler McHenry f ∈ O(g) says, essentially For at least one choice of a constant k > 0, you can find a constant a such that the inequality 0 <= f(x) <= k g(x) holds for all x > a. Note that O(g) is the set of all functions for which this condition holds. f ∈ o(g) says, essentially For every choice of a constant k > 0, you can find a constant a such that the inequality 0 <= f(x) < k g(x) holds for all x > a. Once again, note that o(g) is a set. In Big-O, it is only necessary that you find a particular multiplier k for

Asymptotic complexity of .NET collection classes

喜你入骨 提交于 2019-11-26 06:35:59
问题 Are there any resources about the asymptotic complexity (big-O and the rest) of methods of .NET collection classes ( Dictionary<K,V> , List<T> etc...)? I know that the C5 library\'s documentation includes some information about it (example), but I\'m interested in standard .NET collections too... (and PowerCollections\' information would also be nice). 回答1: MSDN Lists these: Dictionary<,> List<> SortedList<,> (edit: wrong link; here's the generic version) SortedDictionary<,> etc. For example: