下面代码中的 tree 向量,表示的是一棵完全二叉树(−1 代表空节点)按照层序遍历的结果。 #include <vector> std::vector<int> tree = {1, 2, 3, 4, -1, 6, 7};