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 7694c20

Browse files
better docs
1 parent 040a11b commit 7694c20

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

‎src/data-structures/maps/tree-maps/tree-map.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const Tree = require('../../trees/red-black-tree'); // fast insertion
99
*
1010
* Implementing a Map with a tree, TreeMap,
1111
* has a couple of advantages over a HashMap:
12-
* •Keys are always sorted.
13-
* •Statistical data can be easily obtained like median,
12+
* •Keys are always sorted.
13+
* •Statistical data can be easily obtained like median,
1414
* highest, lowest key.
15-
* •Collisions are not a concern so in the worst case is
15+
* •Collisions are not a concern so in the worst case is
1616
* still O(log n).
17-
* •Trees are more space efficient and doesn’t need to
17+
* •Trees are more space efficient and doesn’t need to
1818
* allocate memory beforehand (e.g. HashMap’s initial capacity)
1919
* nor you have to rehash when is getting full.
2020
*

‎src/data-structures/sets/hash-set.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ class HashMapSet {
1717

1818
/**
1919
* Add a new value (duplicates will be added only once)
20+
* Avg. Runtime: O(1)
2021
* @param {any} value
2122
*/
2223
add(value) {
2324
this.hashMap.set(value);
2425
}
2526

2627
/**
27-
* check if value is already on the set
28+
* Check if value is already on the set
29+
* Avg. Runtime: O(1)
2830
* @param {any} value
2931
*/
3032
has(value) {
@@ -40,6 +42,7 @@ class HashMapSet {
4042

4143
/**
4244
* Delete a value from the set
45+
* Avg. Runtime: O(1)
4346
* @param {any} value
4447
*/
4548
delete(value) {

‎src/data-structures/sets/tree-set.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TreeSet {
4040
* @returns {boolean} true if exists or false otherwise
4141
*/
4242
has(value) {
43-
return !!this.tree.get(value);
43+
return this.tree.has(value);
4444
}
4545

4646
/**

0 commit comments

Comments
(0)

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