-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Memory Management: Used std::unique_ptr for automatic memory management, reducing the risk of memory leaks. 2. STL Utilization: Replaced the custom queue implementation with std::queue, simplifying breadth-first traversal. 3. Code Structure: Organized the code into a BinaryTree class, encapsulating the tree functionality and providing clearer interfaces for operations. 4. Redundancy Reduction: Combined logic for finding and removing nodes to reduce redundancy, improving readability and maintainability. 5. Error Handling: Added checks to handle cases where nodes may not be present during removal and traversal.
- Loading branch information
1 parent
9374b00
commit db6f08b
Showing
1 changed file
with
129 additions
and
108 deletions.
There are no files selected for viewing
This file contains 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