Releases: gbvbahia01/BinaryTree
Releases · gbvbahia01/BinaryTree
Generic AVL Tree with Range Query Support
I am excited to announce the first official release (v1.0) of our Generic Binary Search Tree (BST) implementation with AVL balancing in Java. This release introduces a robust and efficient data structure that supports generic types and provides a range of essential operations for managing and querying data.
Key Features
Generic Implementation: Supports any type that extends the BinaryTreeValue interface, allowing for flexibility with custom data types that implement Comparable.
AVL Balancing: Automatically balances the tree after insertions and deletions to ensure optimal performance with O(log n) time complexity for search, insert, and delete operations.
Insertion and Deletion:
insert(T value): Inserts a new value into the tree while maintaining the AVL balance.
remove(T value): Removes a value from the tree and rebalances it if necessary.
Search Operations:
search(T value): Searches for a specific value in the tree and returns an Optional<T>.
Range Queries:
findAllGreaterThanOrEqualTo(T start): Retrieves all elements greater than or equal to the specified value.
findAllLessThanOrEqualTo(T end): Retrieves all elements less than or equal to the specified value.
findAllBetween(T start, T end): Retrieves all elements between two specified values.
Traversal and Visualization:
breadthFirst(): Performs a breadth-first (level-order) traversal of the tree.
toString(): Generates a string representation of the tree in DOT format for visualization using tools like Graphviz.
Utility Methods:
calculateHeight(): Calculates the height of the tree.
isBinarySearchTree(): Validates that the tree maintains the properties of a BST.
Enhancements in This Release
Range Query Methods: Introduced new methods (findAllGreaterThanOrEqualTo, findAllLessThanOrEqualTo, and findAllBetween) to support efficient range queries on the tree data.
Improved Balance and Performance: Enhanced the balancing algorithms to ensure optimal tree height and performance during extensive insertions and deletions.