Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e44079a

Browse files
Retrieve all method hashtable
1 parent 39ff3d0 commit e44079a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎hashTable.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ HashTable.prototype.get = function(key) {
5050
}
5151
}
5252

53+
HashTable.prototype.retrieveAll = function() {
54+
let allNodes = [];
55+
for (let i = 0; i < this.numBuckets; i++) {
56+
let currentNode = this.buckets[i];
57+
console.log('awal', currentNode);
58+
while(currentNode) {
59+
console.log('while', currentNode);
60+
allNodes.push(currentNode);
61+
currentNode = currentNode.next;
62+
}
63+
}
64+
return allNodes;
65+
}
66+
5367
let myHT = new HashTable(30);
5468

5569
myHT.insert('Dean', 'dean@gmail.com');

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /