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
Add version history to readme; add comments; "dynamically persistent"
I described BTree as "semi-persistent", but this sounds like something
that is "incomplete" compared to an ordinary "persistent" data
structure, as a semicircle is merely half a circle, when in fact
"semi-persistent" is something fancier than "persistent". I don't want
to popularize confusing terminology, but I think that the category of
"semi-persistent" data structures is a valuable one. Therefore I chose
another name that doesn't have this drawback but isn't already in use.
Note: my Loyc.Collections C# library contains a several other
"dynamically persistent" types: ALists (including types similar to B+
trees), VLists/WLists, Set/MSet, Map/MMap. For more information,
see http://core.loyc.net/collections/
I call this category of data structure "dynamically persistent" because
28
+
AFAIK no one else has given it a name; it walks the line between mutating
29
+
and [persistent](https://en.wikipedia.org/wiki/Persistent_data_structure).
30
30
- Includes persistent methods such as `with` and `without`, which return a
31
31
modified tree without changing the original (in O(log(size)) time).
32
32
- When a node fills up, items are shifted to siblings when possible to
@@ -36,7 +36,7 @@ Features
36
36
with all keys in a given node.
37
37
- Includes neat stuff such as `Range` methods for batch operations
38
38
- Throws an exception if you try to use `NaN` as a key, but infinity is allowed.
39
-
- No dependencies. 16K minified.
39
+
- No dependencies. 18K minified.
40
40
- Includes a lattice of interfaces for TypeScript users (see below)
41
41
- Supports diffing computation between two trees that is highly optimized for the case
42
42
in which a majority of nodes are shared (such as when persistent methods are used).
@@ -58,7 +58,7 @@ Features
58
58
- Get largest key/pair that is lower than `k`: `t.nextLowerKey(k)`, `t.nextLowerPair(k)`
59
59
- Freeze to prevent modifications: `t.freeze()` (you can also `t.unfreeze()`)
60
60
- Fast clone: `t.clone()`
61
-
- Compute a diff between two trees: `t.diffAgainst(otherTree, ...)`
61
+
- Compute a diff between two trees (quickly skipping shared subtrees): `t.diffAgainst(otherTree, ...)`
62
62
- For more information, **see [full documentation](https://github.com/qwertie/btree-typescript/blob/master/b%2Btree.ts) in the source code.**
63
63
64
64
**Note:** Confusingly, the ES6 `Map.forEach(c)` method calls `c(value,key)` instead of `c(key,value)`, in contrast to other methods such as `set()` and `entries()` which put the key first. I can only assume that they reversed the order on the hypothesis that users would usually want to examine values and ignore keys. BTree's `forEach()` therefore works the same way, but there is a second method `.forEachPair((key,value)=>{...})` which sends you the key first and the value second; this method is slightly faster because it is the "native" for-each method for this class.
@@ -375,6 +375,12 @@ Benchmarks (in milliseconds for integer keys/values)
375
375
Version history
376
376
---------------
377
377
378
+
### v1.5.0 ###
379
+
380
+
- Added `BTree.diffAgainst` method (PR #16)
381
+
- Added `simpleComparator` function (PR #15)
382
+
- Improved `defaultComparator` (PR #15) to support edge cases better. Most notably, heterogenous key types will no longer cause trouble such as failure to find keys that are, in fact, present in the tree. `BTree` is slightly slower using the new default comparator, but the benchmarks above have not been refreshed. For maximum performance, use `simpleComparator` or a custom comparator as the second constructor parameter. The simplest possible comparator is `(a, b) => a - b`, which works for finite numbers only.
383
+
378
384
### v1.4.0 ###
379
385
380
386
- Now built as CommonJS module instead of UMD module, for better compatibility with webpack. No semantic change.
@@ -419,7 +425,6 @@ Version history
419
425
420
426
♥ This package was made to help people [learn TypeScript & React](http://typescript-react-primer.loyc.net/).
421
427
422
-
Are you a C# developer? You might like the similar data structures I made for C#:
423
-
BDictionary, BList, etc. See http://core.loyc.net/collections/
428
+
Are you a C# developer? You might like the similar data structures I made for C# ([BDictionary, BList, etc.](core.loyc.net/collections/alists-part2)), and other [dynamically persistent collection types](http://core.loyc.net/collections/).
424
429
425
430
You might think that the package name "sorted btree" is overly redundant, but I _did_ make a data structure similar to B+ Tree that is _not_ sorted. I called it the [A-List](http://core.loyc.net/collections/alists-part1) (C#). But yeah, the names `btree` and `bplustree` were already taken, so what was I supposed to do, right?
0 commit comments