Solved

Given the HashSet Class Implementation Discussed in Section 16

Question 7

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions