@@ -54,22 +54,42 @@ <h1 class="page-title">Source: data-structures/hash-table.js</h1>
54
54
(function (exports) {
55
55
'use strict';
56
56
57
+ /**
58
+ * Constructs a Node to store data and next/prev nodes in Hash table.
59
+ *
60
+ * @public
61
+ * @constructor
62
+ * @param {Number|String} key Key of the node.
63
+ * @param {Number|String} data Data to be stored in hash table.
64
+ */
57
65
exports.Node = function (key, data) {
58
66
this.key = key;
59
67
this.data = data;
60
68
this.next = undefined;
61
69
this.prev = undefined;
62
70
};
63
71
72
+ /**
73
+ * Construct a Hash table..
74
+ *
75
+ * @public
76
+ * @constructor
77
+ */
64
78
exports.Hashtable = function () {
65
79
this.buckets = [];
66
80
// The higher the bucket count; less likely for collisions.
67
81
this.maxBucketCount = 100;
68
82
};
69
83
70
- /*
71
- Using simple non-crypto x-> integer based hash.
72
- */
84
+ /**
85
+ * Simple non-crypto hash used to hash keys, which determines
86
+ * while bucket the value will be placed in.
87
+ * A javascript implementation of Java's 32bitint hash.
88
+ *
89
+ * @public
90
+ * @method
91
+ * @param {Number|String} val Key to be hashed.
92
+ */
73
93
exports.Hashtable.prototype.hashCode = function (val) {
74
94
var i;
75
95
var hashCode = 0;
@@ -91,6 +111,14 @@ <h1 class="page-title">Source: data-structures/hash-table.js</h1>
91
111
return hashCode;
92
112
};
93
113
114
+ /**
115
+ * Puts data into the table based on hashed key value.
116
+ *
117
+ * @public
118
+ * @method
119
+ * @param {Number|String} key Key for data.
120
+ * @param {Number|String} data Data to be stored in table.
121
+ */
94
122
exports.Hashtable.prototype.put = function (key, data, hashCode) {
95
123
/*
96
124
Make collision testing easy with optional hashCode parameter.
@@ -132,6 +160,13 @@ <h1 class="page-title">Source: data-structures/hash-table.js</h1>
132
160
newNode.prev = first;
133
161
};
134
162
163
+ /**
164
+ * Get's data from the table based on key.
165
+ *
166
+ * @public
167
+ * @method
168
+ * @param {Number|String} key Key for data to be retrieved.
169
+ */
135
170
exports.Hashtable.prototype.get = function (key, hashCode) {
136
171
/*
137
172
Make collision testing easy with optional hashCode parameter.
@@ -171,6 +206,13 @@ <h1 class="page-title">Source: data-structures/hash-table.js</h1>
171
206
}
172
207
};
173
208
209
+ /**
210
+ * Removes data from the table based on key.
211
+ *
212
+ * @public
213
+ * @method
214
+ * @param {Number|String} key Key of the data to be removed.
215
+ */
174
216
exports.Hashtable.prototype.remove = function (key, hashCode) {
175
217
/*
176
218
Make collision testing easy with optional hashCode parameter.
@@ -249,13 +291,13 @@ <h1 class="page-title">Source: data-structures/hash-table.js</h1>
249
291
</ div >
250
292
251
293
< nav >
252
- < h2 > < a href ="index.html "> Home</ a > </ h2 > < h3 > Modules</ h3 > < ul > < li > < a href ="module-combinatorics_cartesianproduct.html "> combinatorics/cartesianproduct</ a > </ li > < li > < a href ="module-combinatorics_combinations.html "> combinatorics/combinations</ a > </ li > < li > < a href ="module-combinatorics_permutations.html "> combinatorics/permutations</ a > </ li > < li > < a href ="module-combinatorics_variations-repetition.html "> combinatorics/variations-repetition</ a > </ li > < li > < a href ="module-data-structures_avl-tree.html "> data-structures/avl-tree</ a > </ li > < li > < a href ="module-data-structures_binary-search-tree.html "> data-structures/binary-search-tree</ a > </ li > < li > < a href ="module-data-structures_edge.html "> data-structures/edge</ a > </ li > < li > < a href ="module-data-structures_hash-table.html "> data-structures/hash-table</ a > </ li > < li > < a href ="module-data-structures_heap.html "> data-structures/heap</ a > </ li > < li > < a href ="module-data-structures_interval-tree.html "> data-structures/interval-tree</ a > </ li > < li > < a href ="module-data-structures_linked-list.html "> data-structures/linked-list</ a > </ li > < li > < a href ="module-data-structures_red-black-tree.html "> data-structures/red-black-tree</ a > </ li > < li > < a href ="module-data-structures_splay-tree.html "> data-structures/splay-tree</ a > </ li > < li > < a href ="module-data-structures_vertex.html "> data-structures/vertex</ a > </ li > < li > < a href ="module-graphs_others_topological-sort.html "> graphs/others/topological-sort</ a > </ li > < li > < a href ="module-graphs_searching_bfs.html "> graphs/searching/bfs</ a > </ li > < li > < a href ="module-graphs_searching_dfs.html "> graphs/searching/dfs</ a > </ li > < li > < a href ="module-graphs_shortest-path_bellman-ford.html "> graphs/shortest-path/bellman-ford</ a > </ li > < li > < a href ="module-graphs_shortest-path_dijkstra.html "> graphs/shortest-path/dijkstra</ a > </ li > < li > < a href ="module-graphs_shortest-path_floyd-warshall.html "> graphs/shortest-path/floyd-warshall</ a > </ li > < li > < a href ="module-graphs_spanning-trees_prim.html "> graphs/spanning-trees/prim</ a > </ li > < li > < a href ="module-others_fibonacci.html "> others/fibonacci</ a > </ li > < li > < a href ="module-others_hanoi.html "> others/hanoi</ a > </ li > < li > < a href ="module-others_levenshtein-distance.html "> others/levenshtein-distance</ a > </ li > < li > < a href ="module-others_minCoinsChange.html "> others/minCoinsChange</ a > </ li > < li > < a href ="module-primes_is-prime.html "> primes/is-prime</ a > </ li > < li > < a href ="module-primes_prime-factor-tree.html "> primes/prime-factor-tree</ a > </ li > < li > < a href ="module-primes_sieve-of-eratosthenes.html "> primes/sieve-of-eratosthenes</ a > </ li > < li > < a href ="module-searching_binarysearch.html "> searching/binarysearch</ a > </ li > < li > < a href ="module-searching_knuth-morris-pratt.html "> searching/knuth-morris-pratt</ a > </ li > < li > < a href ="module-searching_longest-increasing-subsequence.html "> searching/longest-increasing-subsequence</ a > </ li > < li > < a href ="module-searching_maximum-subarray.html "> searching/maximum-subarray</ a > </ li > < li > < a href ="module-searching_maximum-subarray-divide-and-conquer.html "> searching/maximum-subarray-divide-and-conquer</ a > </ li > < li > < a href ="module-searching_quickselect.html "> searching/quickselect</ a > </ li > < li > < a href ="module-searching_recursive-binarysearch.html "> searching/recursive-binarysearch</ a > </ li > < li > < a href ="module-sets_quickfind.html "> sets/quickfind</ a > </ li > < li > < a href ="module-sets_quickunion.html "> sets/quickunion</ a > </ li > < li > < a href ="module-sets_weightquickunion.html "> sets/weightquickunion</ a > </ li > < li > < a href ="module-shuffle_fisheryates.html "> shuffle/fisheryates</ a > </ li > < li > < a href ="module-shuffle_richarddurstenfeld.html "> shuffle/richarddurstenfeld</ a > </ li > < li > < a href ="module-sorting_3-way-string-quicksort.html "> sorting/3-way-string-quicksort</ a > </ li > < li > < a href ="module-sorting_bubblesort.html "> sorting/bubblesort</ a > </ li > < li > < a href ="module-sorting_bucketsort.html "> sorting/bucketsort</ a > </ li > < li > < a href ="module-sorting_countingsort.html "> sorting/countingsort</ a > </ li > < li > < a href ="module-sorting_heapsort.html "> sorting/heapsort</ a > </ li > < li > < a href ="module-sorting_insertion-binary-sort.html "> sorting/insertion-binary-sort</ a > </ li > < li > < a href ="module-sorting_insertionsort.html "> sorting/insertionsort</ a > </ li > < li > < a href ="module-sorting_lsd.html "> sorting/lsd</ a > </ li > < li > < a href ="module-sorting_mergesort.html "> sorting/mergesort</ a > </ li > < li > < a href ="module-sorting_mergesort_merge.html "> sorting/mergesort/merge</ a > </ li > < li > < a href ="module-sorting_msd.html "> sorting/msd</ a > </ li > < li > < a href ="module-sorting_oddeven-sort.html "> sorting/oddeven-sort</ a > </ li > < li > < a href ="module-sorting_quicksort-middle.html "> sorting/quicksort-middle</ a > </ li > < li > < a href ="module-sorting_recursive-insertionsort.html "> sorting/recursive-insertionsort</ a > </ li > < li > < a href ="module-sorting_selectionsort.html "> sorting/selectionsort</ a > </ li > < li > < a href ="module-sorting_shellsort.html "> sorting/shellsort</ a > </ li > </ ul > < h3 > Classes</ h3 > < ul > < li > < a href ="module-data-structures_avl-tree.AVLTree.html "> AVLTree</ a > </ li > < li > < a href ="module-data-structures_avl-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_binary-search-tree.BinaryTree.html "> BinaryTree</ a > </ li > < li > < a href ="module-data-structures_binary-search-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_heap.Heap.html "> Heap</ a > </ li > < li > < a href ="module-data-structures_interval-tree.IntervalTree.html "> IntervalTree</ a > </ li > < li > < a href ="module-data-structures_interval-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_linked-list.LinkedList.html "> LinkedList</ a > </ li > < li > < a href ="module-data-structures_linked-list.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_red-black-tree.RBTree.html "> RBTree</ a > </ li > < li > < a href ="module-data-structures_splay-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_splay-tree.SplayTree.html "> SplayTree</ a > </ li > < li > < a href ="module-graphs_spanning-trees_prim.Graph.html "> Graph</ a > </ li > < li > < a href ="module-sets_quickfind.QuickFind.html "> QuickFind</ a > </ li > < li > < a href ="module-sets_quickunion.QuickUnion.html "> QuickUnion</ a > </ li > < li > < a href ="module-sets_weightquickunion.QuickUnion.html "> QuickUnion</ a > </ li > </ ul >
294
+ < h2 > < a href ="index.html "> Home</ a > </ h2 > < h3 > Modules</ h3 > < ul > < li > < a href ="module-combinatorics_cartesianproduct.html "> combinatorics/cartesianproduct</ a > </ li > < li > < a href ="module-combinatorics_combinations.html "> combinatorics/combinations</ a > </ li > < li > < a href ="module-combinatorics_permutations.html "> combinatorics/permutations</ a > </ li > < li > < a href ="module-combinatorics_variations-repetition.html "> combinatorics/variations-repetition</ a > </ li > < li > < a href ="module-data-structures_avl-tree.html "> data-structures/avl-tree</ a > </ li > < li > < a href ="module-data-structures_binary-search-tree.html "> data-structures/binary-search-tree</ a > </ li > < li > < a href ="module-data-structures_edge.html "> data-structures/edge</ a > </ li > < li > < a href ="module-data-structures_hash-table.html "> data-structures/hash-table</ a > </ li > < li > < a href ="module-data-structures_heap.html "> data-structures/heap</ a > </ li > < li > < a href ="module-data-structures_interval-tree.html "> data-structures/interval-tree</ a > </ li > < li > < a href ="module-data-structures_linked-list.html "> data-structures/linked-list</ a > </ li > < li > < a href ="module-data-structures_red-black-tree.html "> data-structures/red-black-tree</ a > </ li > < li > < a href ="module-data-structures_splay-tree.html "> data-structures/splay-tree</ a > </ li > < li > < a href ="module-data-structures_vertex.html "> data-structures/vertex</ a > </ li > < li > < a href ="module-graphs_others_topological-sort.html "> graphs/others/topological-sort</ a > </ li > < li > < a href ="module-graphs_searching_bfs.html "> graphs/searching/bfs</ a > </ li > < li > < a href ="module-graphs_searching_dfs.html "> graphs/searching/dfs</ a > </ li > < li > < a href ="module-graphs_shortest-path_bellman-ford.html "> graphs/shortest-path/bellman-ford</ a > </ li > < li > < a href ="module-graphs_shortest-path_dijkstra.html "> graphs/shortest-path/dijkstra</ a > </ li > < li > < a href ="module-graphs_shortest-path_floyd-warshall.html "> graphs/shortest-path/floyd-warshall</ a > </ li > < li > < a href ="module-graphs_spanning-trees_prim.html "> graphs/spanning-trees/prim</ a > </ li > < li > < a href ="module-others_fibonacci.html "> others/fibonacci</ a > </ li > < li > < a href ="module-others_hanoi.html "> others/hanoi</ a > </ li > < li > < a href ="module-others_levenshtein-distance.html "> others/levenshtein-distance</ a > </ li > < li > < a href ="module-others_minCoinsChange.html "> others/minCoinsChange</ a > </ li > < li > < a href ="module-primes_is-prime.html "> primes/is-prime</ a > </ li > < li > < a href ="module-primes_prime-factor-tree.html "> primes/prime-factor-tree</ a > </ li > < li > < a href ="module-primes_sieve-of-eratosthenes.html "> primes/sieve-of-eratosthenes</ a > </ li > < li > < a href ="module-searching_binarysearch.html "> searching/binarysearch</ a > </ li > < li > < a href ="module-searching_knuth-morris-pratt.html "> searching/knuth-morris-pratt</ a > </ li > < li > < a href ="module-searching_longest-increasing-subsequence.html "> searching/longest-increasing-subsequence</ a > </ li > < li > < a href ="module-searching_maximum-subarray.html "> searching/maximum-subarray</ a > </ li > < li > < a href ="module-searching_maximum-subarray-divide-and-conquer.html "> searching/maximum-subarray-divide-and-conquer</ a > </ li > < li > < a href ="module-searching_quickselect.html "> searching/quickselect</ a > </ li > < li > < a href ="module-searching_recursive-binarysearch.html "> searching/recursive-binarysearch</ a > </ li > < li > < a href ="module-sets_quickfind.html "> sets/quickfind</ a > </ li > < li > < a href ="module-sets_quickunion.html "> sets/quickunion</ a > </ li > < li > < a href ="module-sets_weightquickunion.html "> sets/weightquickunion</ a > </ li > < li > < a href ="module-shuffle_fisheryates.html "> shuffle/fisheryates</ a > </ li > < li > < a href ="module-shuffle_richarddurstenfeld.html "> shuffle/richarddurstenfeld</ a > </ li > < li > < a href ="module-sorting_3-way-string-quicksort.html "> sorting/3-way-string-quicksort</ a > </ li > < li > < a href ="module-sorting_bubblesort.html "> sorting/bubblesort</ a > </ li > < li > < a href ="module-sorting_bucketsort.html "> sorting/bucketsort</ a > </ li > < li > < a href ="module-sorting_countingsort.html "> sorting/countingsort</ a > </ li > < li > < a href ="module-sorting_heapsort.html "> sorting/heapsort</ a > </ li > < li > < a href ="module-sorting_insertion-binary-sort.html "> sorting/insertion-binary-sort</ a > </ li > < li > < a href ="module-sorting_insertionsort.html "> sorting/insertionsort</ a > </ li > < li > < a href ="module-sorting_lsd.html "> sorting/lsd</ a > </ li > < li > < a href ="module-sorting_mergesort.html "> sorting/mergesort</ a > </ li > < li > < a href ="module-sorting_mergesort_merge.html "> sorting/mergesort/merge</ a > </ li > < li > < a href ="module-sorting_msd.html "> sorting/msd</ a > </ li > < li > < a href ="module-sorting_oddeven-sort.html "> sorting/oddeven-sort</ a > </ li > < li > < a href ="module-sorting_quicksort-middle.html "> sorting/quicksort-middle</ a > </ li > < li > < a href ="module-sorting_recursive-insertionsort.html "> sorting/recursive-insertionsort</ a > </ li > < li > < a href ="module-sorting_selectionsort.html "> sorting/selectionsort</ a > </ li > < li > < a href ="module-sorting_shellsort.html "> sorting/shellsort</ a > </ li > </ ul > < h3 > Classes</ h3 > < ul > < li > < a href ="module-data-structures_avl-tree.AVLTree.html "> AVLTree</ a > </ li > < li > < a href ="module-data-structures_avl-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_binary-search-tree.BinaryTree.html "> BinaryTree</ a > </ li > < li > < a href ="module-data-structures_binary-search-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_hash-table.Hashtable.html "> Hashtable</ a > </ li > < li > < a href ="module-data-structures_hash-table.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_heap.Heap.html "> Heap</ a > </ li > < li > < a href ="module-data-structures_interval-tree.IntervalTree.html "> IntervalTree</ a > </ li > < li > < a href ="module-data-structures_interval-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_linked-list.LinkedList.html "> LinkedList</ a > </ li > < li > < a href ="module-data-structures_linked-list.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_red-black-tree.RBTree.html "> RBTree</ a > </ li > < li > < a href ="module-data-structures_splay-tree.Node.html "> Node</ a > </ li > < li > < a href ="module-data-structures_splay-tree.SplayTree.html "> SplayTree</ a > </ li > < li > < a href ="module-graphs_spanning-trees_prim.Graph.html "> Graph</ a > </ li > < li > < a href ="module-sets_quickfind.QuickFind.html "> QuickFind</ a > </ li > < li > < a href ="module-sets_quickunion.QuickUnion.html "> QuickUnion</ a > </ li > < li > < a href ="module-sets_weightquickunion.QuickUnion.html "> QuickUnion</ a > </ li > </ ul >
253
295
</ nav >
254
296
255
297
< br class ="clear ">
256
298
257
299
< footer >
258
- Documentation generated by< a href ="https://github.com/jsdoc3/jsdoc "> JSDoc 3.3.0-alpha13 </ a > onMon Jul13 201516: 17:46 GMT+0300 (EEST )
300
+ Documentation generated by< a href ="https://github.com/jsdoc3/jsdoc "> JSDoc 3.3.2 </ a > onWed Jul15 2015 17:47:03 GMT-0500 (Central Daylight Time )
259
301
</ footer >
260
302
261
303
< script > prettyPrint ( ) ; </ script >