|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hash table
Hi,
I have a dynamic list of key value pairs. The keys are not sequential. I need to implement a data Structure in C++ which can give me optimal insert,delete and most important Search. I thought of using Maps or Hash tables. which one would give me best performance?? |
|
#2
|
||||
|
||||
|
Hash will probably give you the fastest search. However, when you use a hash, the data may be returned from the hash in a different order from how you inserted them in (which means, they're not sorted in any particular order
). If sort order is not important to you, go with the Hash, otherwise go with the map.See the notes for Hashed Associative Containers and Sorted Associative Containers in the links below --- it says that a Hashed Associative Container is much faster. http://www.sgi.com/tech/stl/HashedA...eContainer.html http://www.sgi.com/tech/stl/HashedA...eContainer.html
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
|
#3
|
|||
|
|||
|
Thanks for the information. The links are really helpful. Is the STL provided by SGI the only one available or there are others also which are more efficient?
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Hash table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|