hashtable code in java

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: hashtable code in java

  1. #1
    Join Date
    Aug 2005

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

    can some one send me the code using hashtable

  2. #2
    Join Date
    Aug 2004
    Isn't this the same question you posted here?


    And is being actively discussed (and answered) here?


Similar Threads

  1. DevX does seem one sideded
    By Rob Abbe in forum Talk to the Editors
    Replies: 44
    Last Post: 01-13-2003, 03:57 PM
  2. Has Sun Given Up on the Desktop?
    By Lori Piquet in forum Talk to the Editors
    Replies: 114
    Last Post: 10-10-2002, 07:01 AM
  3. Replies: 1
    Last Post: 05-08-2002, 08:17 AM
  4. Are Comments a Waste of Time?
    By Glen Kunene in forum Java
    Replies: 25
    Last Post: 04-22-2002, 06:45 PM
  5. Future of Java....
    By JW in forum Careers
    Replies: 14
    Last Post: 02-14-2001, 05:37 PM

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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