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!

Recommended Answers

All 4 Replies

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....

>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.

Care to elaborate?

>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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.