-
-
Notifications
You must be signed in to change notification settings - Fork 331
Add Binary Search Tree (BST) data structure implementation [HACKTOBERFEST 2025] #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Binary Search Tree (BST) data structure implementation [HACKTOBERFEST 2025] #159
Conversation
- Complete BST implementation using R6 object-oriented programming - Support all fundamental operations: insert, search, delete, traversals - Include four traversal methods: inorder, preorder, postorder, level-order - Advanced operations: height calculation, BST validation, kth smallest - Tree visualization with ASCII art representation - Comprehensive examples including student grade management system - Create new Data Structures category for fundamental CS data structures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive Binary Search Tree (BST) data structure using R6 object-oriented programming, providing fundamental tree operations with optimal time complexity for educational and practical applications.
- Complete BST implementation with all core operations (insert, search, delete, traversals)
- R6 object-oriented design with proper encapsulation of private helper methods
- Educational examples demonstrating real-world applications like student grade management
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
data_structures/binary_search_tree.r | Complete BST implementation with nodes, tree operations, traversals, utility functions, and comprehensive test examples |
DIRECTORY.md | Added Data Structures section with Binary Search Tree entry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add this data structure to DIRECTORY.md
@siriak its already there |
87d4f86
to
602f7b0
Compare
@siriak I've just pushed the latest version to ensure the files are properly visible. The PR includes: ✅ Binary Search Tree Implementation (
✅ DIRECTORY.md Update
The files should now be visible. Please let me know if you can see them now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
🚀 Overview
This PR implements a complete Binary Search Tree (BST) data structure using R6 object-oriented programming - providing the foundation for advanced tree-based algorithms and data management.
✨ Features
🎯 Why This Matters
Binary Search Trees are fundamental for:
📚 Implementation Details
🔧 Core Operations
Basic Operations:
insert(value)
- Add new node maintaining BST propertysearch(value)
- Find if value exists in treedelete(value)
- Remove node with three deletion casesfind_min()
/find_max()
- Find extreme valuesTraversal Methods:
inorder_traversal()
- Returns sorted sequencepreorder_traversal()
- Root-left-right orderpostorder_traversal()
- Left-right-root orderlevel_order_traversal()
- Breadth-first traversalAdvanced Features:
height()
- Calculate tree heightis_valid_bst()
- Verify BST propertyprint_tree()
- ASCII visualizationkth_smallest()
- Find kth smallest element🎓 Educational Examples
Student Grade Management: