Thread: database

  1. #1
    Unregistered
    Guest

    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?

  2. #2
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    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.

  3. #3
    Unregistered
    Guest

    Smile

    Thanks for your reply. Fair enough, just living in hope...How might this normally be gotten around ten? In terms of logical structure/code?

  4. #4
    Unregistered
    Guest
    Opps! that was supposed to be then, not ten!

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >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
    My best code is written with the delete key.

  6. #6
    Unregistered
    Guest

    Smile

    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...

  7. #7
    Unregistered
    Guest

    Smile

    If you happen to think of anything to keep me on the right track, I'll be chained here for a while...

    thanks again.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    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
    My best code is written with the delete key.

  9. #9
    Unregistered
    Guest
    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...

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >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

    -Prelude
    My best code is written with the delete key.

  11. #11
    Unregistered
    Guest

    Thumbs up

    Hope you don't get too sick of me. Registering now...

  12. #12
    Registered User
    Join Date
    Mar 2002
    Posts
    1
    ok,done. see you soon, looking at search algorithms. hopefully come up with a little code, rather than all my gabbing!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. literature database: help with planning
    By officedog in forum C++ Programming
    Replies: 1
    Last Post: 01-23-2009, 12:34 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Replies: 10
    Last Post: 05-18-2006, 11:23 PM
  4. Developing database management software
    By jdm in forum C++ Programming
    Replies: 4
    Last Post: 06-15-2004, 04:06 PM
  5. Making a Simple Database System
    By Speedy5 in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2003, 10:17 PM