Hash is not O(1)
Are you sure?
 "Many hash table designs also allow arbitrary insertions and deletions of keyvalue pairs, at constant average (indeed, amortized) cost per operation."  http://en.wikipedia.org/wiki/Hash_table
 http://en.wikipedia.org/wiki/Big_O_notation
 "Thus, everyone knows that hash table queries run in amortized constant time. That is, as the number of keys increases, the average time necessary to recover a keyvalue pair does not increase."  http://lemire.me/blog/archives/2009/08/18/dohashtablesworkinconstanttime/
 "Hash tables, sometimes also known as associative arrays, or scatter tables, are a data structure that offers fast lookup, insertion, and deletion of (key, value) pairs. In a welldesigned implementation of hash tables, all of these operations have a time complexity of O(1), rather than the O(n) that linked lists, association lists, and vectors would require for some of them."  http://www.math.utah.edu/~beebe/software/hash/hash.html
 "Perl hashes provide constanttime lookups. They are implemented as true hash tables (with automatic retuning as necessary), not associative arrays."  http://stackoverflow.com/questions/3774904/whatisthetimecomplexityforlookingupaniteminaperlhash
 http://www.sysarch.com/Perl/sort_paper.html
I'll grant that an individual lookup might consume greater than O(1) time, but in the aggregate it's fairly well established and accepted that hash operations are O(1) operations, where 'n' is the number of elements in the hash.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
 a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:

For: 

Use: 
 &   & 
 <   < 
 >   > 
 [   [ 
 ]   ] 
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.

