release: 1.50.0. docs: traversal methods

This commit is contained in:
Revone 2023-12-29 11:24:25 +08:00
parent 34d4abd9e6
commit baf1be4035
4 changed files with 27 additions and 3 deletions

View file

@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
## [v1.49.9](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
## [v1.50.0](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
### Changes

View file

@ -1,6 +1,6 @@
{
"name": "data-structure-typed",
"version": "1.49.9",
"version": "1.50.0",
"description": "Data Structures of Javascript & TypeScript. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree(BST), AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack. Benchmark compared with C++ STL. API aligned with ES6 and Java.util. Usability is comparable to Python",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",

View file

@ -547,6 +547,14 @@ export class BST<
// }
/**
* Time complexity: O(n)
* Space complexity: O(n)
*/
/**
* Time complexity: O(n)
* Space complexity: O(n)
*
* The function overrides the depth-first search method and returns an array of the return types of
* the callback function.
* @param {C} callback - The `callback` parameter is a function that will be called for each node
@ -572,6 +580,14 @@ export class BST<
}
/**
* Time complexity: O(n)
* Space complexity: O(n)
*/
/**
* Time complexity: O(n)
* Space complexity: O(n)
*
* The function overrides the breadth-first search method and returns an array of the return types of
* the callback function.
* @param {C} callback - The `callback` parameter is a function that will be called for each node
@ -594,6 +610,14 @@ export class BST<
}
/**
* Time complexity: O(n)
* Space complexity: O(n)
*/
/**
* Time complexity: O(n)
* Space complexity: O(n)
*
* The function overrides the listLevels method and returns an array of arrays containing the return
* type of the callback function for each level of the tree.
* @param {C} callback - The `callback` parameter is a generic type `C` that extends

View file

@ -23,7 +23,7 @@ describe('AVL Tree Test from data-structure-typed', () => {
expect(getMinNodeBySpecificNode?.key).toBe(12);
let subTreeSum = 0;
node15 && tree.subTreeTraverse(node => (subTreeSum += node.key), 15);
node15 && tree.dfs(node => (subTreeSum += node.key), 'pre', 15);
expect(subTreeSum).toBe(70);
let lesserSum = 0;