public void IsNonExistentKeyRemoveConstantTime() { DictionaryTesting.TestComplexityGrowth( DictionaryTesting.CreateOrderedDictionary, dictionary => dictionary.Remove(0), (dictionary, count) => { for (var i = 0; i < count; i++) { dictionary.Remove(0); } }); }
public void IsRemoveConstantTime() { var rng = new Random(); DictionaryTesting.TestComplexityGrowth( DictionaryTesting.CreateOrderedDictionary, dictionary => dictionary.Remove(rng.Next()), (dictionary, count) => { for (var i = 0; i < count; i++) { dictionary.Remove(rng.Next(count)); } }); }
public void IsNonExistentKvpRemoveConstantTime() { var kvp = KeyValuePair.Create(1, 1); DictionaryTesting.TestComplexityGrowth( DictionaryTesting.CreateOrderedDictionary, dictionary => dictionary.Remove(kvp), (dictionary, count) => { for (var i = 0; i < count; i++) { dictionary.Remove(kvp); } }); }
public void IsKvpRemoveConstantTime() { var rng = new Random(); DictionaryTesting.TestComplexityGrowth( DictionaryTesting.CreateOrderedDictionary, dictionary => { var j = rng.Next(dictionary.Count); var kvp = KeyValuePair.Create(j, j); dictionary.Remove(kvp); }, (dictionary, count) => { for (var i = 0; i < count; i++) { var j = rng.Next(count); var kvp = KeyValuePair.Create(j, j); dictionary.Remove(kvp); } }); }