Is there any search algorithm with time complexity O(1)?
Search Algorithm = Finding an element x from n elements.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Although I would be surprised if a search algorithm that was deterministically O(1) existed, the good news is that you can get lookup that is arbitrarily close to 100% accurate with O(1) add and lookup operations using a bloom filter. (http://en.wikipedia.org/wiki/Bloom_filter)
Similarly, a variety of techniques exist for those sets with finite sizes (http://en.wikipedia.org/wiki/Perfect_hash_function) although if those set sizes are very large problems arise in practice
However, to the general case, the answer is, to the best of my knowledge, no. And certainly not in any practical applications.