good performance requires a good hashing function for the encountered data. if the hashing is poor (such as producing the same hash value for every input), then line 6 would be executed o("n") times (i.e. on every iteration of the loop). because character-by-character comparison of strings with length "m" takes o(m) time, the whole algorithm then takes a worst-case o("mn") time.