-
database
I need to write a database prog that lets the user search by using one or more search options. Which strucure do you think I should use? A binary search tree seems the most appropriate, but it ain't all that easy for a newbie, and I haven't been able to work out a way of doing it with linked lists yet. Would an array of structs work?
-
You hav to create the search tree before you search it, and it needs to be updated very often. Maybe not a good idea. Just a thought.
-
Thanks for your reply. Fair enough, just living in hope...How might this normally be gotten around ten? In terms of logical structure/code?
-
Opps! that was supposed to be then, not ten!
-
>I haven't been able to work out a way of doing it with linked lists yet
If you can't figure it out with linked lists then a binary tree is out of the question.
>Would an array of structs work?
Yes, provided you either make the array large enough to begin with or you are willing to resize the array with realloc. Depending on the complexity of the database you can do anything from arrays to a balanced binary tree that uses hashing and all the frills.
-Prelude
-
ok, many thanks, only bin programming 3 days, so a bit of a uphill struggle! I'll go down the array of structs path with realloc...
-
If you happen to think of anything to keep me on the right track, I'll be chained here for a while...
thanks again.
-
You're writing a database program after 3 days? You might consider taking things a bit slower, especially with C which isn't the easiest of languages. Even a simple database such as the one you want is going to be tough with 3 days of experience.
-Prelude
-
well, I always like a challenge! Luckily, I haven't got to write it IN three days! Don't get me wrong, I'm not making light of what looks like a pretty complex project, but if you don't try...
-
>but if you don't try...
You might want to register on these boards then, because I suspect I'll be seeing you quite a bit on this project :D
-Prelude
-
Hope you don't get too sick of me. Registering now...
-
ok,done. see you soon, looking at search algorithms. hopefully come up with a little code, rather than all my gabbing!