Thread: c++ database search

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    74

    c++ database search

    hi all,

    i have made a database and do sequential searching of it, but i found smart device c++ is different from others since it is so slow to finish the searching. i am a beginner of it, can anyone suggest what can i do for the database searching such as using pointer or redesign of the database?

    thanks!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Have you considered using an embedded database engine, e.g., SQLite?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    By "database" do you mean a list of data or a relational database. If it's a list you can use and ordered index structure like a binary search tree to make access faster.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Perspective View Post
    By "database" do you mean a list of data or a relational database. If it's a list you can use and ordered index structure like a binary search tree to make access faster.
    Or if it's a basic array structure, a plain "binary search" [aka "midpoint search"] can be used to search quicker.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    74
    but what if my database contains chinese character which cannot be sorted and searched by binary search?
    thanks

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    74
    Quote Originally Posted by laserlight View Post
    Have you considered using an embedded database engine, e.g., SQLite?

    had u tried it? is it faster for searching?

    actually i dun understand why smart device application is so slow for array searching even i run it in emulator on desktop, not on pda, but java or c# can be much faster.
    anybody know why? thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Database Search Algorithm
    By Krupux in forum C Programming
    Replies: 1
    Last Post: 08-28-2003, 09:57 PM