This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Linked-list, binary tree? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Linked-list, binary tree?" Watch "Linked-list, binary tree?" New topic
Author

Linked-list, binary tree?

Bill Norton
Greenhorn

Joined: Mar 29, 2001
Posts: 27
Hello,
I'm wanting to read in a flat text file and then store this information in memory while my app runs. Everyonce in a while I will need to re-write this data back onto the disk. I am not concerned about reading and writing the file(this seems pretty straight forward) but rather how to store this data in a way that is efficient and retrival time is quick. Also, the first and second column would always be different and I would need to be able to get one from the other.
The file might look something like this
smith 1234.12345.12345 workerB
johnson 1223.12121.12122 workerC
There would be approx. 5000 entries like this.
Hopefully this is enough information, and again I am looking for the best data structure to use with Java(I think in C a tree structure was used in this case). But any hints would be welcome.
Thanks,
Bill
Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
I think reading the data is pretty much the same, one line at a time. Retrieving is another matter. I also think tree is excellent, almost 1/2 the time to search and retrieve compared to linked list.
Bill Norton
Greenhorn

Joined: Mar 29, 2001
Posts: 27
Thanks for the reply.
Does Java have built in classes for trees?
If not is there a class simliar to trees?
Bill
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Linked-list, binary tree?
 
Similar Threads
Data Structure for displays in JTree?
Data Structure for display in JTree?
Store Data in Tree Node
Displaying a tree?
Dynamic Casting?