|
-
August 7th, 2008, 06:15 AM
#10
Re: Hashtables
 Originally Posted by GCDEF
I don't think it's based on a hash table, but an STL map serves the same purpose.
You're right, they're not based on hash tables, but on trees. Usually, the implementations of std::map are actually red-black trees.
Regarding the purpose of them, there're a couple of differences. As Lindley has already said, most of them come from the fact that trees provide you an ordering mechanism while hash tables don't. On the other hand, good implementations of hash tables provide you amortized constant time for accessing elements (assuming an efficient key and a balanced table).
Last edited by ltcmelo; August 7th, 2008 at 06:25 AM.
Reason: Fixed typo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|