943,699 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 839
  • C++ RSS
Nov 19th, 2007
0

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

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Ratte is offline Offline
38 posts
since Oct 2007
Nov 19th, 2007
0

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

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....
Reputation Points: 10
Solved Threads: 0
Light Poster
Ratte is offline Offline
38 posts
since Oct 2007
Nov 19th, 2007
0

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

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Nov 19th, 2007
0

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

Care to elaborate?
Reputation Points: 10
Solved Threads: 0
Light Poster
Ratte is offline Offline
38 posts
since Oct 2007
Nov 19th, 2007
0

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

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: 2d arrays
Next Thread in C++ Forum Timeline: Quick pseudocode question for anyone who might be able to help...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC