问题
I am trying to implement a B+ tree myself, but I want to create a method that prints what elements does the B+ tree have. If I use a traversal(in or post order) I will get also the elements in the parent nodes, therefore I will have duplicate values. Is there a way to solve this thing? Thanks
回答1:
Mark the nodes as you traverse them. Once the node is marked, it can't be traversed.
来源:https://stackoverflow.com/questions/9917715/b-tree-print-elements-is-order