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

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2007
Posts: 35
Reputation: Ratte is an unknown quantity at this point 
Solved Threads: 0
Ratte's Avatar
Ratte Ratte is offline Offline
Light Poster

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

 
0
  #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!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
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....

 
0
  #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 Quick reply to this message  
Join Date: Sep 2004
Posts: 7,602
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: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

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

 
0
  #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 Quick reply to this message  
Join Date: Oct 2007
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....

 
0
  #4
Nov 19th, 2007
Care to elaborate?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,602
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: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

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

 
0
  #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 Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC