hashtable code in java
I have question about hash function in java.
I have a problem to solve in java .
The problem is you have array of integers say a --- has 2 3 4 5
now i have integer b = 7.
We have to write a programm that if sum of any 2 numbers in array equals to b then return true else return false.
Problem is very easy i did this using 2 for loops but the thing is that using 2 for loops you are getting O(n^2) so this is not good.
I need to used some method to make it 0(N) which is linear.So i thought we can use hash functionas it is O(N) donot worry about memory as hash takes alot of memory.
So i need someone can solve this problem in hash table using java.I am new to java and have no idea about hash table.
can some one send me the code using hashtable
Isn't this the same question you posted here?
And is being actively discussed (and answered) here?
By Rob Abbe in forum Talk to the Editors
Last Post: 01-13-2003, 02:57 PM
By Lori Piquet in forum Talk to the Editors
Last Post: 10-10-2002, 06:01 AM
Last Post: 05-08-2002, 07:17 AM
By Glen Kunene in forum Java
Last Post: 04-22-2002, 05:45 PM
Last Post: 02-14-2001, 04:37 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL