diff --git a/CHANGELOG.md b/CHANGELOG.md index 6721045..bad3641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package.json b/package.json index 4db1c24..3acbf2f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/data-structures/binary-tree/bst.ts b/src/data-structures/binary-tree/bst.ts index 27be108..d94b78d 100644 --- a/src/data-structures/binary-tree/bst.ts +++ b/src/data-structures/binary-tree/bst.ts @@ -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 diff --git a/test/integration/all-in-one.test.ts b/test/integration/all-in-one.test.ts index 34f8443..88a0b5b 100644 --- a/test/integration/all-in-one.test.ts +++ b/test/integration/all-in-one.test.ts @@ -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;