Re:Ask HN: Have you ever needed to invert a binary tree at w...
by sdevonoes on Friday May 21, 2021 @11:22AM
(#27235223)
As a professional developer, if I am faced with the task of dealing with binary trees at work, I would never:
- implement my own binary tree
- implement my own "invert a binary tree" algorithm
Reasons:
- my own implementation would be way worse than any other open source implementation (which has been reviewed extensively) in terms of: performance, number of bugs, correctness
- it would be a hell to maintain for future developers that have to maintain my code
- it just makes sense. Well understood algorithms do not require re-implementation
- implement my own binary tree
- implement my own "invert a binary tree" algorithm
Reasons:
- my own implementation would be way worse than any other open source implementation (which has been reviewed extensively) in terms of: performance, number of bugs, correctness
- it would be a hell to maintain for future developers that have to maintain my code
- it just makes sense. Well understood algorithms do not require re-implementation