Java Reference
In-Depth Information
**27.8
( Animate quadratic probing ) Write a program that animates quadratic probing,
as shown in Figure 27.5. You can change the initial size of the hash-table in pro-
gram. Assume the load-factor threshold is 0.75 .
**27.9
( Implement hashCode for string ) Write a method that returns a hash code for
string using the approach described in Section 27.3.2 with b value 31 . The func-
tion header is as follows:
public static int hashCodeForString(String s)
**27.10
( Compare MyHashSet and MyArrayList ) MyArrayList is defined in Listing
24.3. Write a program that generates 1000000 random double values between 0
and 999999 and stores them in a MyArrayList and in a MyHashSet . Generate
a list of 1000000 random double values between 0 and 1999999 . For each num-
ber in the list, test if it is in the array list and in the hash set. Run your program to
display the total test time for the array list and for the hash set.
**27.11
( setToList ) Write the following method that returns an ArrayList from a set.
public static <E> ArrayList<E> setToList(Set<E> s)
 
 
Search WWH ::




Custom Search