Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search algorithm

 
Gennady Shapiro
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the marking criteria of this assignment is the search algorithm. Since our DB is not relation and our records are not indexed in any way what kind of search can we do except a simple linear search??
I mean every record has to be tested for matching values every time, which give us O(n) time. I don't really see how this can be improved.
Anyone?
 
Eru Stone
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also already thought about that. Maybe an index could be created in Memory as soon as it is needed. Of course this gives us a memory consumption of O(n). But since we are not allowed to alter the DB, this would be the only possibility to speed it up!?
But having an index in memory means also to take care of it's contents during inserts, updates and deletes....
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add another thought, in Sun's requirements they state that:
"a simple design that can be readily understood by junior programmers would be preferred over a complex design even if that design is more efficient."
Maybe just a sequential search would be better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic