[29/N] Add unit tests for BTree, TreeMap, SkipList, and DisjointSet algorithms - #120
Open
karkir0003 wants to merge 29 commits into
Conversation
…de, and AnimatedCircularlyLinkedListNode
This was referenced Oct 3, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 Stack
Addresses #93
Context
Adds comprehensive unit test coverage for the advanced search tree, skip list, and disjoint set algorithm visualizers:
BTree.js: B-Tree multi-element search tree with node splits, promotions, searches, predecessor/successor deletions, and custom tree string builder.TreeMap.js: Key-value balanced map (AVL-backed) with put, get, remove, and rotation rebalancing.SkipList.js: Multi-level probabilistic skip list with tower additions, coin flips, forward/down pointer traversal, and deletions.DisjointSet.js: Disjoint set / union-find visualizer with dual array and tree representations, union-by-rank, and path compression.Changes Made
src/algo/__tests__/BTree.test.js:buildTreeparsing pipe-and-comma format ("2,9,13|1|5,6,7|11,12|14,16") and problem detection (treeHasProblem).promote,predSucc,data).src/algo/__tests__/TreeMap.test.js:src/algo/__tests__/SkipList.test.js:addWithHeads) and random coin flips (addRandomly).get), random population, and reset.src/algo/__tests__/DisjointSet.test.js:getSizes), reset, and clear.Test Plan
npm test -- --watchAll=false(all 4 new test suites pass, 59 unit tests passing).npm run lintandnpm run prettier(0 errors, 0 warnings).