Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm implementing a hashtable structure for a dictionary. Dictionary is in a text file. There are 2 words on each line. I'm generating the hashtable by using the first word as a key. I'm holding the hashtable on a list. I want to save the hashtable to a text file to use it every time. What kind of structure should I use? Is there a way to do this without reading the whole hashtable from text file?

share|improve this question
3  
The question doesn't make any sense. You're building a hashtable from a dictionary file - why do you need another file? –  Ben C Apr 29 '12 at 15:11
    
to save the hashtable. –  Rafaela Arcuri Apr 29 '12 at 15:16
add comment

1 Answer

up vote 1 down vote accepted

You are looking for serialization.

In Python you could use pickle. In Java you can do it too. Almost every language has techniques for serialization.

If your hashtable becomes too big, you will have to use a relational database management sysyem, like MySQL, PostgreSQL, Oracle, SQL Server, etc.

share|improve this answer
1  
Binary serialization can be a big pain, particularly if objects change over time. This leaves us with textual serialization, which should be ... just a CSV file with two columns : key and value :) –  Job Apr 29 '12 at 19:24
    
That's what I thought too, but maybe for some reason she doesn't want to read or write the CSV again. –  Vitalij Zadneprovskij Apr 29 '12 at 19:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.