Suppose I have a file with n words. As I read each word in the file, I will store it in hash (in Perl). When I go back and look up for the word in the hash, what is the time complexity of looking up a string(word) in a hash?
For example:
my %seen = ();
@arr=("one","two","three");
foreach $item (@arr){
if($seen{$item}) {//do something}
}
In this program, I am looking up for an item in the hash. What is time complexity of looking up for a string in a hash?
Also, could any elaborate on how hash is implemented in Perl? (internally something happens in hash? or is it just an associative array)