fix bug in radix trie
This commit is contained in:
parent
70fb80a9fc
commit
4fcfea409a
2 changed files with 32 additions and 14 deletions
|
|
@ -27,6 +27,8 @@ const with7Items = insert(with6Items)('ab')('yup');
|
|||
console.log(pretty(with7Items));
|
||||
const with8Items = insert(with7Items)('')('hi!');
|
||||
console.log(pretty(with8Items));
|
||||
const with9Items = insert(with8Items)('fo')(42);
|
||||
console.log(pretty(with9Items));
|
||||
|
||||
///////////////////
|
||||
// Setup TRIE 2 ...
|
||||
|
|
@ -82,11 +84,22 @@ assert.deepEqual(
|
|||
]);
|
||||
|
||||
assert.equal(
|
||||
isProperlySorted(with8Items),
|
||||
isProperlySorted(with9Items),
|
||||
true,
|
||||
"trie should always be properly sorted!"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
get(with9Items)(''),
|
||||
"hi!"
|
||||
)
|
||||
|
||||
|
||||
assert.equal(
|
||||
get(with9Items)('fo'),
|
||||
42
|
||||
)
|
||||
|
||||
assert.equal(
|
||||
isProperlySorted(bigTrie),
|
||||
true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue