How to store table with a large number of fields?

Using a hash table with keyword searches.?

  • A little background: The project is to store a file of "mp3s" in the form Title|Artist into a hash table. Some of the functions i need to write are search by title, search by artist, search by keyword and insert into a playlist. I am just confused as to how to initialize a hash table that would allow me to do this... here are the direct directions involving the hash table... "The data structure used to store the master music index is up to you, however, you are required to use a hash table to implement keyword searches, enabling an O(1) average case lookup. When reading the master list of music, you can hash the words in the title and artist as you read each song or you can read everything first and then hash after the end of the input file is reached. When your program starts, it must build the hash table and any other data structures that you use in O(N log N) time or better, where N is the number of songs in the input file." any help to better understand how to implement a hash table into a keyword search like this would be very helpful, thanks

  • Answer:

    take each title and hash the words of the title so Johny Be Good, Hash Johny = 27, Hash Good = 87 build and index/hash table Song 1, Hash 27 Song 1, Hash 87 then you can keyword search on Johny or Good

Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.