You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book-pro/content/part03/map.asc
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,12 +25,13 @@ The attractive part of Maps is that they are very performant usually *O(1)* or *
25
25
* *HashMap*: it’s a map implementation using an *array* and a *hash function*. The job of the hash function is to convert the `key` into an index that maps to the `value`. Optimized HashMap can have an average runtime of *O(1)*.
26
26
* *TreeMap*: it’s a map implementation that uses a self-balanced Binary Search Tree (like <<AVL Tree>>). The BST nodes store the key, and the value and nodes are sorted by key guaranteeing an *O(log n)* look up.
27
27
28
-
28
+
<<<
29
29
include::hashmap.asc[]
30
30
31
+
<<<
31
32
include::treemap.asc[]
32
33
33
-
34
+
<<<
34
35
==== HashMap vs TreeMap
35
36
36
37
.A map can be implemented using hash functions or binary search tree:
0 commit comments