“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
Create an algorithm that can store 100 business cards and return the information quickly(no external databases), keeping in mind that the company would want to increase the no. of cards later !
Hashtable would required an extra overhead of Synchronization. If its not a case of multiple threads, I would use HashMap and if required, use “Collections.synchronizedMap” to make it thread safe. But I concur with the kind of data structure the above poster used.
Submitted By: vinay chilakamarri — October 26, 2008
Also its important to have that datastructure as a “Serializable” class so you can persist it to the file system. Make your own serialVersionUID just in case
Use a hash table or a BST.
Hashtable would required an extra overhead of Synchronization. If its not a case of multiple threads, I would use HashMap and if required, use “Collections.synchronizedMap” to make it thread safe. But I concur with the kind of data structure the above poster used.
Also its important to have that datastructure as a “Serializable” class so you can persist it to the file system. Make your own serialVersionUID just in case
Leave an Answer/Comment