File tree Expand file tree Collapse file tree 1 file changed +1
-4
lines changed
src/dataStructures/hashSet/openAddressing Expand file tree Collapse file tree 1 file changed +1
-4
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public int size() {
129
129
*/
130
130
public List <T > toList () {
131
131
return Arrays .stream (this .buckets )
132
- .filter (element -> element != null || this . TOMBSTONE . equals (element ))
132
+ .filter (element -> element != null && ! element . equals (this . TOMBSTONE ))
133
133
.collect (Collectors .toList ());
134
134
}
135
135
@@ -158,8 +158,6 @@ private int hashFunction(T element) {
158
158
/**
159
159
* Given an element, returns the index of an empty (defined as null OR tombstone) bucket to insert the element at.
160
160
* If the element is already present in the HashSet, return its index.
161
- * TODO If the ratio of the number of elements to the number of buckets (n / m) exceeds the load factor,
162
- * TODO trigger a resize. (currently throws a RunTimeException).
163
161
*
164
162
* @param element the given element to probe an empty bucket for.
165
163
* @return the index of an empty bucket.
@@ -183,7 +181,6 @@ private int linearProbe(T element) {
183
181
}
184
182
currentBucketIndex = (currentBucketIndex + 1 ) % this .capacity ();
185
183
}
186
- resize (); // TODO implement resize operation.
187
184
return ELEMENT_NOT_FOUND ; // placeholder return value for now. Will never reach this line.
188
185
}
189
186
You can’t perform that action at this time.
0 commit comments