I'm getting ready for an interview, and some obvious interview questions, such as counting the frequency of characters in a string, include placing all the characters in a Hashtable / Dictionary to get O (n) runtime for the algorithm. My question is: what is the efficiency using ContainsKey and TryGetValue to check if a key has already been inserted into a Hashtable? Can I still have an O (n) algorithm for such problems that use ContainsKey or TryGetValue ?
alexD
source share