I would like to know the most efficient way to delete an entire binary search tree. also not to let any memory leak so having to check if all the nodes in the sub trees are deleted first.
I cant think of any efficient way besides post order traversal, deleting as you go. any suggestions or ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…