RSS Forums RSS

Help with finding a good use for a hash table in my program....

Please support our C++ advertiser: Programming Forums
Thread Solved
Reply
Posts: 35
Reputation: Ratte is an unknown quantity at this point 
Solved Threads: 0
Ratte's Avatar
Ratte Ratte is offline Offline
Light Poster

Question Help with finding a good use for a hash table in my program....

  #1  
Nov 19th, 2007
I have a person datafile of many entries. Persons will be stored in a linked list and each of the person amongst other things will have a linked list of items belonging to them.

The object of the program is to use a quicksort algorithm to print out entries of persons based on some item that they have.

My question is, what/where could I use a hash table (chaining?) in my program. I need to incorporate it somewhere in this program and I am not exactly sure in which part should I use it and for what purpose. I know I am being a bit vague, so feel free to ask more questions.

Thanks!
AddThis Social Bookmark Button
Reply With Quote  
Posts: 35
Reputation: Ratte is an unknown quantity at this point 
Solved Threads: 0
Ratte's Avatar
Ratte Ratte is offline Offline
Light Poster

Re: Help with finding a good use for a hash table in my program....

  #2  
Nov 19th, 2007
OK looks like I found a use myself.

I just read the entire file into a hash table and then pass the hash array to a quicksort function to sort it....
Reply With Quote  
Posts: 7,460
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 676
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Help with finding a good use for a hash table in my program....

  #3  
Nov 19th, 2007
>what/where could I use a hash table (chaining?) in my program.
That's ass backward. It's a solution looking for a problem, not a problem looking for a solution.
I'm here to prove you wrong.
Reply With Quote  
Posts: 35
Reputation: Ratte is an unknown quantity at this point 
Solved Threads: 0
Ratte's Avatar
Ratte Ratte is offline Offline
Light Poster

Re: Help with finding a good use for a hash table in my program....

  #4  
Nov 19th, 2007
Care to elaborate?
Reply With Quote  
Posts: 7,460
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 676
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Help with finding a good use for a hash table in my program....

  #5  
Nov 19th, 2007
>Care to elaborate?
You don't say "I have a hash table and I want to use it somewhere". You look at your problem and determine what data structure is best suited to it. That way you don't end up using the wrong solution for your problem. A lot of bad code has been written in the name of solutions searching for problems.
I'm here to prove you wrong.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 643 | Replies: 4 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:36 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC