DEV Community 👩‍💻👨‍💻

Discussion on: Binary Search Tree Class Implementation

Collapse
 
tandrieu profile image
Thibaut Andrieu

Hi !

Glad to see that some still accord importance to data structure 😀
I advice you to replace naked pointer (aka node*) by smart pointer like std::shared_ptr. The small overhead introduced by smart ptr is largely counterbalanced by the better and easier memory management you will gain.

You save time by not handling crazy memory issues => you have more time to do real optimization to your algorithm => your program runs faster.

Collapse
 
qbaocaca profile image
Quoc Bao

Thank you very much for your advice. I am still a student and have much to learn <3