top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Java: Need a fully functional hash table with time complexity for search O(n)

+1 vote
100 views

I need a fully functional hash table with time complexity for search O(n). Can someone please help me?

posted Sep 30, 2013 by Vivek Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Hash with o(n) ????, hash has complexity as o(1). Are you sure about your question?

1 Answer

0 votes

For search O(n) ,then you can use array of fixed size & collision can be avoided by chaining using linked
list in this case worse case when all n elements maps to the same index , linear search will take O(n)
time to find the element. In order to get the O(1) search ,Create an array of size max( all a[i]) and then map each element corresponding to their index.

answer Oct 1, 2013 by Arvind Singh
Similar Questions
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...