need help for Hash Function in Java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: need help for Hash Function in Java

  1. #1
    Join Date
    Aug 2005
    Posts
    2

    need help for Hash Function in Java

    Hello,

    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[3] --- 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 new to java and have no idea about hash table.

    So kindly send me the code for this or explain me how to use hash thing.
    my email is alirazvi@gmail.com


    Ali
    Last edited by alirazvi; 08-18-2005 at 03:17 PM.

Similar Threads

  1. Packed Data(Comp-3, etc)
    By Marcos in forum VB Classic
    Replies: 3
    Last Post: 01-25-2006, 11:18 AM
  2. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 06:46 AM
  3. AnimateWindow API
    By Tim Manos in forum VB Classic
    Replies: 4
    Last Post: 10-19-2001, 06:06 AM
  4. JAVADOTNET !!!
    By Dharmesh in forum .NET
    Replies: 4
    Last Post: 10-01-2001, 03:47 PM
  5. calling ping thru vb
    By Michael Shutt in forum VB Classic
    Replies: 6
    Last Post: 04-05-2001, 02:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center