PratikshaChuryaA / Hactoberfest2023

This is open repo for all beginners push yours codes here.
12 stars 111 forks source link

enhanced the code's readability, usability, and functionality #82

Open Anshuman7080 opened 1 month ago

Anshuman7080 commented 1 month ago

Generalized Insertion: Now, the insert method finds the next available position in a level-order fashion, which allows for easier tree expansion. Destructor: Added a destructor that ensures all dynamically allocated nodes are freed, preventing memory leaks. Input Handling: Simplified the interaction for user input and removed the need for position specification during insertion. Complexity: Insertion: O(n) in the worst case (when the tree is a complete binary tree). Traversals: O(n) for all traversal methods, where n is the number of nodes in the tree. This code will now provide a more user-friendly interface and better memory management while maintaining the basic functionalities of a binary tree.

Anshuman7080 commented 1 month ago

Please assign me this.