wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> microsoft >> Database Search
(Message started by: mad on Feb 5th, 2008, 5:56am)

Title: Database Search
Post by mad on Feb 5th, 2008, 5:56am
How do you search for a word in a large database?
Suggest efficient data structures, algorithms or indices for the same.

Title: Re: Database Search
Post by Grimbal on Feb 5th, 2008, 6:13am
Is the question like: how to implement a database?

What kind of database is it?  Is it like a dictionary and you search the definition of a word, or is it like a documents database and you search where the word appears?

Title: Re: Database Search
Post by mad on Feb 6th, 2008, 9:53am
Say it is a database of documents and you search where the word appears

Title: Re: Database Search
Post by Grimbal on Feb 6th, 2008, 10:08am
Create for each word the list of documents where it appears.

It is quite easy.  Create one file for each word.  The file being conveniently named after the file.  Parse all the documents, and every time you find a word you write the name of the document in the file.

Well, maybe you should first remove duplicates from the document.

So: for each document, parse the document and store a list of unique words in a hash table.  Then, for each word, append the ID fo the document at the end of the file named after the word.  Create the files as necessary.

Title: Re: Database Search
Post by iatkrox on Jul 2nd, 2012, 9:49am
Make a search bot !!! Then he will do the work for you  ;)

Title: Re: Database Search
Post by kylajams on Aug 27th, 2012, 3:35am
Even I wish to know the answer.

Title: Re: Database Search
Post by kentonson on Nov 7th, 2012, 8:11am
Any new algorithm for searching ::) I wish to know well ...



Title: Re: Database Search
Post by cartoonle on Dec 13th, 2012, 4:01am
You should build a inverted index like search engines do. The best for this job are NoSQL databases like Big table from Google.

Title: Re: Database Search
Post by webtasarim on Oct 6th, 2013, 4:40pm
i m gonna use simple words

Title: Re: Database Search
Post by pratisaad on Oct 10th, 2013, 5:17am
Microsoft SQL is the good database for security purpose.

Title: Re: Database Search
Post by towr on Oct 10th, 2013, 8:58am
That's both doubtful and irrelevant.

Title: Re: Database Search
Post by Grimbal on Oct 10th, 2013, 3:07pm
Yeah, but if it's Microsoft who asks at a job interview...

Title: Re: Database Search
Post by webtasarim on Oct 21st, 2013, 3:42am
binary search algorithm can be the best one .

In computer science, a binary search or half-interval search algorithm finds the position of a specified input value (the search "key") within an array sorted by key value.[1][2] In each step, the algorithm compares the search key value with the key value of the middle element of the array. If the keys match, then a matching element has been found and its index, or position, is returned. Otherwise, if the search key is less than the middle element's key, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the search key is greater, on the sub-array to the right. If the remaining array to be searched is empty, then the key cannot be found in the array and a special "not found" indication is returned.
A binary search halves the number of items to check with each iteration, so locating an item (or determining its absence) takes logarithmic time. A binary search is a dichotomic divide and conquer search algorithm.

source : wikipedia.org

Title: Re: Database Search
Post by Grimbal on Oct 21st, 2013, 4:35am
Binary search is useless in locating occurences of a word in a set of documents.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board