CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is the easiest searching method to use?
Category C Interview Questions
Rating (2.5) By 2 users
Added on 10/22/2004
Views 3150
Rate it!
Answers:

Just as qsort() was the easiest sorting method, because it is part of the standard library, bsearch() is the
easiest searching method to use. If the given array is in the sorted order bsearch() is the best method.

Following is the prototype for bsearch():

void *bsearch(const void *key, const void *buf, size_t num, size_t size, int (*comp)(const void *, const void*));

Another simple searching method is a linear search. A linear search is not as fast as bsearch() for searching among a large number of items, but it is adequate for many purposes. A linear search might be the only method available, if the data isn?t sorted or can?t be accessed randomly. A linear search starts at the beginning and sequentially compares the key to each element in the data set.





If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What is the quickest searching method to use?
View Answer
What is hashing?
View Answer
How can I sort a linked list?
View Answer
How can I search for data in a linked list?
View Answer
How do you redirect a standard stream?
View Answer
How can you restore a redirected standard stream?
View Answer
What is the difference between text and binary modes?
View Answer
How do you determine whether to use a stream function or a low-level function?
View Answer
How can I open a file so that other programs can update it at the same time?
View Answer
How can I make sure that my program is the only one accessing a file?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/1045/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.88