Given the HashSet class implementation discussed in section 16.4 (partially shown below) , select the statement needed to complete the clear method, which is designed to remove all elements from the set. public class HashSet
{
Private Node[] buckets;
Private int currentSize;
Public HashSet(int bucketsLength)
{
Buckets = new Node[bucketsLength];
CurrentSize = 0;
}
Public void clear()
{
For (int j = 0; j < buckets.length; ++j)
{
___________________________
}
CurrentSize = 0;
}
) ..
}
A) buckets[j] = 0;
B) buckets[j] = new Node() ;
C) buckets[j] = null;
D) buckets[j] = new LinkedList() ;
Correct Answer:
Verified
Q55: Linked list operations that were studied included
Q72: Which of the following statements about hash
Q74: Assume that you have a hash table
Q75: Given the ArrayStack class implementation discussed in
Q76: Given the LinkedListQueue class implementation discussed in
Q77: A stack can be implemented as a
Q81: Complete the following code, which is intended
Q82: Complete the following code snippet, which is
Q84: What is the time required to iterate
Q89: Which hash table method(s) will make use
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents