The Artima Developer Community
Sponsored Link

Java Answers Forum
hash question

3 replies on 1 page. Most recent reply: Jun 1, 2004 5:42 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
arpi kadakia

Posts: 3
Nickname: arpi
Registered: May, 2004

hash question Posted: May 30, 2004 9:52 PM
Reply to this message Reply
Advertisement
hi all

i have a hw question that asks me to hand trace these numbers using the method hash with bin size 7: 10 33 98 18 44 22 77 66 99 11 34 55. frankly, i dont know what this means, and i cant find any info on it, if anyone can help me, i would greatly appreciate it. thanks


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: hash question Posted: May 30, 2004 10:04 PM
Reply to this message Reply
http://condor.depaul.edu/~ntomuro/courses/416/assign/hw7.html

??

Hw??

arpi kadakia

Posts: 3
Nickname: arpi
Registered: May, 2004

Re: hash question Posted: May 30, 2004 10:09 PM
Reply to this message Reply
that link doesnt really help me, there wasnt much info on it, i need to sort those numbers using hash sort with bin size 7

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: hash question Posted: Jun 1, 2004 5:42 PM
Reply to this message Reply
Your bin could be an array of Lists of the size specified as the bin size. So a bin size of 7 would be an array of 7 Lists. You could get the hashCode() of the key object, modulo by the bin size (7) and store the key and its value object (in an Item object of your own making, probably) in the List[/i] at that index. Only if it's not already in the list, of course. Naturally, you should make the bin size a variable, rather than hard-coded to 7. You'll find that "real" implementations of hash tables will adjust the size of the bin, based on the size of the collection -- as it grows, they'll create a new, bigger bin and move all the objects into the new bin. You'll want to have your hash table implement ][i]java.util.Dictio[/b] interface, which will provide additional guidance as to how to proceed.

Flat View: This topic has 3 replies on 1 page
Topic: Writting to a text pad file... Previous Topic   Next Topic Topic: Seconds to hours

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use