11-2 Tree Construction

题目大意:构造BST,输出双亲节点。 思路:新加进来的点,其父亲要么是比他大的值中最小的,或者是比他小的值中的最大的。那么后加入的那个节点就是该节点的父亲节点。 理由: 平衡二叉树的中序遍历是有序的,那么 #include<iostream> #include<vector> #include<set> #include<map> using namespace std; set<int>::it
相关文章
相关标签/搜索