Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2008, 03:25 AM
Member
 
Join Date: Jan 2008
Posts: 12
rhm54 is on a distinguished road
Hash Table help
Alright I need to develop a hash table using an array that can only hold 10 items. The program will not store the usernames but rather only the passwords in an array. The index will be generated by taking the username and hasing it. I think I have my hashing function

Code:
public int hash_function(String key) { int KeyVal = 0; for (int i=0; i<key.length(); i++) { KeyVal += key.charAt(i); } int index = 0; for(int i = 0; i < key.length(); i++){ index = KeyVal%10; } if (database[index] == null){ return index; } else hash_function(key + "Qvc" + KeyVal); } // end of hash_function
My problem is two fold. How can the program tell me if a username has been used before if it is not stored in the program. Also how can I retrieve data from the table if the algorithm is set up to call itself again if the index it returns is full?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hash table with double hashing Java Tip java.lang 0 04-12-2008 10:43 PM
Hash table with linear probing Java Tip java.lang 0 04-12-2008 10:43 PM
Hash table with separate chaining Java Tip java.lang 0 04-12-2008 10:42 PM
Vectors of Vectors or hash-somethings? mindwarp New To Java 3 03-10-2008 04:57 PM
Table Help CoOlbOyCoOl NetBeans 1 05-06-2007 06:19 PM


All times are GMT +3. The time now is 04:53 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org