Results 1 to 5 of 5

Thread: Java HashTables

  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    1,018

    Unhappy Java HashTables

    Ok, I'll admit it... my pride has been wounded. I consider myself a pretty astute patron of search engines, but sometimes one has to admit defeat.

    I am trying to find a good tutorial on hashTables. I have read the Sun Api, but for some reason, I can't quite wrap my melon around the concept. Arrays were easy, and so were vectors... they gave "visual " examples, so I ws able to understand how they worked.

    I have searched "java hashtables tutorials", "java hashtables reference", " java hashtables", "java hashtables how-to", and even "java hashtables illustrated", but still nothing that seems to make the ole synapsis fire.

    Anybody have any references?

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    1,050
    Maybe this could be of some help ?

    http://www.google.com/search?q=%22ja...utf-8&oe=utf-8

    searched for "java" +hashtable

    Also if you stick a +howto on to it it narrows the results happy hunting
    By the sacred **** of the sacred psychedelic tibetan yeti ....We\'ll smoke the chinese out
    The 20th century pharoes have the slaves demanding work
    http://muaythaiscotland.com/

  3. #3
    Senior Member
    Join Date
    Aug 2003
    Posts
    1,018
    Ok, then to take it one step further, would a proper characterization be that a hashtable is basically an array of arrays of varying length? The main array holds the 'bucket', which is accessed by the key, and then the bucket holds my other values, whether it be strings or objects?

    If that's the case, then I understand perfectly.

  4. #4
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Doesn't have to be like that. You can have whatever you want at the index. I did a project using a circularlylinkedlist at each index of a hash table. There are also other methods of dealing with collisions not involving extra arrays or linked lists, they simply go to the next available index if the one from the key is full. This is from my courses webpage...
    Linear Probing - collisions are resolved by sequenaially scanning an array(with wrap-around) until an empty cell is found.
    Quadratic Probing - examines cells 1, 4, 9 and so on, away from the original probe point. If the table size is prime and the load factor is no larger than 0.5(half full), then all probes will be to different locations and an item can always be inserted.
    Separate Chaining Hashing - Separate chaining hashing is a space-efficient alternative to quadratic probing in which we maintain an array of linked lists. It is less sensitive to high load factors.
    http://www.cs.utsa.edu/~javalab/cs17...es/week10.html
    there's a little bit more explaination of other aspects of it, but it's not real in depth. Here is a lab if you wanted something to work on with a hash table...
    http://www.cs.utsa.edu/~javalab/cs17...ationEx10.html
    and here is the project we did...
    http://www.cs.utsa.edu/~mdoderer/cs1.../project3.html
    if you want my source for the recitation I can give it to you, I wouldn't go by my source for the project though , lol.
    I'm not sure it worked how it was supposed to. Hope this helped.

  5. #5
    Senior Member
    Join Date
    Aug 2003
    Posts
    1,018
    You must spread your AntiPoints around before giving it to h3r3tic again.


    Yes, that helped alot. That's actually kind of nice your school puts that on the web. Most places password protect it I found a few other things that were interesting also

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •