January 2012
Intermediate to advanced
396 pages
8h 16m
English
How much time does it take to check whether an element is present in a list-based collection?
In order to determine whether a given item is in a collection or not, we have to call the Contains() method on linear containers.
The following are the steps to create the benchmarking code that I have used. You shall have to change the Contain()
method accordingly, to alter it for the next benchmarking on another equivalent container:
Main() method, add the following code:static void Main(string[] args)
{
HashSet<char> codes = new HashSet<char>();
string alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
foreach (char c in alphabets)
codes.Add(c);
Dictionary<int, double> perfMap = new Dictionary<int, ...Read now
Unlock full access