MCPcopy
hub / github.com/trekhleb/javascript-algorithms / find

Method find

src/data-structures/heap/Heap.js:194–204  ·  view source on GitHub ↗

* @param {*} item * @param {Comparator} [comparator] * @return {Number[]}

(item, comparator = this.compare)

Source from the content-addressed store, hash-verified

192 * @return {Number[]}
193 */
194 find(item, comparator = this.compare) {
195 const foundItemIndices = [];
196
197 for (let itemIndex = 0; itemIndex < this.heapContainer.length; itemIndex += 1) {
198 if (comparator.equal(item, this.heapContainer[itemIndex])) {
199 foundItemIndices.push(itemIndex);
200 }
201 }
202
203 return foundItemIndices;
204 }
205
206 /**
207 * @return {boolean}

Callers 11

removeMethod · 0.95
MinHeap.test.jsFile · 0.45
MaxHeap.test.jsFile · 0.45
setMethod · 0.45
deleteMethod · 0.45
getMethod · 0.45
findByValueMethod · 0.45
hasEdgeMethod · 0.45
hasNeighborMethod · 0.45
findEdgeMethod · 0.45
isSafeFunction · 0.45

Calls 2

equalMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected