nalply / rbts Goto Github PK
View Code? Open in Web Editor NEWTypescript red-black tree
License: ISC License
Typescript red-black tree
License: ISC License
202 line's key !== node.key
is acts like a reference comparison for an Object.
so, It is impossible to process a case where an object of the nature of a record is used as a key.
It would be better to add comparator like equalOp?: (a: K, b: K) => boolean
in Tree<K, V>
constructor parameter.
/** @internal */_findNode(
key: K,
node: Node<K, V> = this._root,
): Node<K, V> {
while (node.ok && key !== node.key)
// ^^^^^^^^^^^^^^^^ --- here is problem
node = this._less(key, node) ? node._left : node._right
return node
}
Line 98 in 822038a
AssertionError: invariant violated: expected 'left is smaller (at b with depth 1)' to be false
Line 272 in 827af6c
throws:
TypeError: Cannot assign to read only property '_black' of object '[object Object]'
Lines 12 to 16 in 25e5a34
use ok()
and nil()
with isTrue()
instead
Line 8 in 589327d
tsc: command not found
, probably due to the above.Profile both in Node and in the browser.
Following this Code Repository Badges Tutorial...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.