Search Algorithm

Posted on 2008-11-03
Last Modified: 2012-05-05
A client of mine has asked me to create a search algorithm (I'm not sure yet what the "datasource" I'll be searching against).  I have no idea where to start!!!!  I've never been asked to program an algorithm before.  I want to believe that .net has some algorithm class(es) built into it already that i can leverage.

need any advice or links to information that will get me started.  I have only a few days to let the client know whether I am able to handle his request.
Question by:davidcahan
    LVL 18

    Expert Comment

    well, depending of the class, .net have some function the implements some search algoritms. but it all depends of the input.
    What you search?
    Where you search (a database?)
    What kind of output?
    LVL 1

    Expert Comment

    Assuming its a relational database, you would be using .net's ADO.NET object model (System.Data) to send SQL queries to the database.
    The .net framework has the foundation to implement just about anything... however you should ask your client to give you specific details on what you will be searching before you can tell him whether or not you can do it.

    Author Comment

    very true...i do need more information.  the one thing i'll say is that both of us are programmers and have been for quite some time.  He specifically said "algorithm" and not "query" so I'm assuming he is talking about something more than a simple query.

    i just need some advice on where to even start.  I do searches online and don't really find much of what i'm looking for (which would be any information regarding, sql server and building algorithms).
    LVL 18

    Accepted Solution

    well, as you know, algorithm are not language depeandant.
    Common search algorithme invlove sorted array or more advanced data structure as a binary tree.
    .net has a Dictionary class for key/object association.
    there is also class like Generic.List that have methods like find, findAll and findFirst
    here an exemple for FindAll
    LVL 1

    Assisted Solution

    Lets say your client were to ask you to search through a list of stock prices by date and find all date ranges with an average rate of increase greater than some threshold.
    This is just an example, but there is no defined algorithm in .net ot in any language to do that - you would need to piece it together using data structures, loops, comparitive operators, etc.

    Thats half the fun in programming.. figuring out how to solve a problem using conventional programming tactics.

    Author Comment

    by:davidcahan really "algorithm" is just a way to say "a routine that searches through data in some systematic way (and hopefully quickly)".  so technically a stored procedure that selects data could be an algorithm?  or inserting items into an array() and then searching through them could be an algorithm?

    I probably should have mentioned this beforem, but I do know this about the project:

    As an example of what he wanted, He did say something about a search for "red apple" and then results:  100% red apple, 80% green apple, 70% apple, 60% orange, 40% red banana.
    LVL 1

    Assisted Solution

    Yes. Whatever routine you end up using to get the end results is the algorithm.
    Depending on which data structures you decide to use in the implementation of the algorithm, there may be methods to help you along the way.. as davrob60 mentioned above - certain collection classes have find methods to save you from having to manually loop through them.
    As for which data structures to use in your algorithm - thats completely dependent on the problem being solved by it, and what kind of information it needs to process. Deciding that is up to you, the process architect.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now