C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 5th, 2003, 10:29 AM
rajeev_sam rajeev_sam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 rajeev_sam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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??

Reply With Quote
  #2  
Old November 5th, 2003, 12:45 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 8,100 Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 16th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 54 m 48 sec
Reputation Power: 2059
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

Reply With Quote
  #3  
Old November 6th, 2003, 02:20 PM
rajeev_sam rajeev_sam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 rajeev_sam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Hash table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT