Class DictionaryBasedOccurrencesCounter
An implementation of IOccurrencesCounter which uses a
Inheritance
System.Object
DictionaryBasedOccurrencesCounter
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: MoreStructures.Lists.Counting
Assembly: MoreStructures.dll
Syntax
public class DictionaryBasedOccurrencesCounter : IOccurrencesCounter
Methods
| Improve this Doc View SourceCount<T>(IEnumerable<T>)
Declaration
public IDictionary<T, IDictionary<int, int>> Count<T>(IEnumerable<T> enumerable)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | enumerable |
Returns
Type | Description |
---|---|
IDictionary<T, IDictionary<System.Int32, System.Int32>> |
Type Parameters
Name | Description |
---|---|
T | The type of items of |
Remarks
Perform counting by keeping a T
and index, while enumerating
enumerable
.
Both Time Complexity and Space Complexity are O(n * sigma), where n = number of items in
enumerable
and sigma = number of the alphabet of enumerable
, i.e. the
number of distinct items of type T
in enumerable
.