I tried to compare the performance of a hash table lookup and linear search. I created a hashtable containing 1000 items and found out the time taken to do a look up in the hash table to be 0.0002 (I used DateTime.Now
to find out the system time before and after the look up and subtracted them). I had the same 1000 rows in an array and looked up the same value using linear search. And it turned out to be lesser than the time taken by hash table look up.
I thought hash tables are faster than linear search. How does it work?