标签:pre values fine add lan several because init OLE
CSE 274
Summer 2019
Project #5
Hash Table with Separate Chaining and Trees
There are 2 parts to this assignment: Complete the set that uses a hash table implementation using separate chaining
Implement several tree processing algorithms
1. (70 pts) HashTable Implementation. Do not use any standard Java collection classes (e.g., TreeSet,
TreeMap, HashSet, etc.) for this work.
Submit a HashedSetSC.java and Car.java.
a. (5 pts) Create a class to represent a car - Car - that year (int), make (String), model (String), and color
(String). Car should override the equals and hashCode methods.
b. (65 pts) Create a class - HashedSetSC - that implement a set using a hash table. Assume that the
data type being stored has proper equals and hashCode methods defined. HashedSetSC class
will be similar to the HashedDictionary class presented in the textbook but will use separate
chaining to resolve collisions. Another difference is that your class will not be a dictionary (i.e., key-value
pairs), instead it will be used to represent a set.
The individual buckets must be implemented using your list implementation other than a Java standard
CSE 274作业代写、代做Python,c/c++程序语言作业
list. It is suggested that you use LinkedListWithIterator class defined in the
ListImplementation project.
Notes:
● Your hashed set implementations must implement the SetInterface used in a previous
project.
● Allocating and using the hashTable array will differ from the textbook’s examples. This is
because of Java’s peculiar behavior with arrays of generic structures. The rough outline of the
class will be:
public class HashedSetSC<T> implements HashedSetSC {
private LinkedListWithIterator<T> [] hashTable;
private final int INIT_CAPACITY = 71;
@SuppressWarnings("unchecked")
public HashedSetSC() {
hashTable = (LinkedListWithIterator <T>[])new LinkedListWithIterator<?>[INIT_CAPACITY ];
...
}
}
2. (30 pts) Tree Processing. In the TreeImplementation project, add and implement the following methods to the
BinaryTree class.
a. (10) public T getMaxLeaf() // returns largest leaf value
b. (10) public Set<T> getLeaves() // returns all leaf values
c. (10) public boolean isBalanced()
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp
标签:pre values fine add lan several because init OLE
原文地址:https://www.cnblogs.com/goodjava/p/11284903.html