摘要:        
树的遍历: 关键在与如何利用中序和后序建树。 中序的作用,提供了左右子树的所有节点的分布! 前序,后序的作用:就是第一个元素(最后一个元素)提供了根节点,让中序找到子树的分布情况。 玩转二叉树: 这里的改变只是在建树的时候,把原本左子树放在实际的右子树上,原本的右子树放在左子树上。    阅读全文
posted @ 2019-03-22 22:10
青山新雨
阅读(516)
评论(0)
推荐(0)
        
            
        
        
摘要:        
这里唯一需要注意的是,各个输出的条件在题目中有点描述模糊。 是朋友关系,(不管是不是间接朋友关系) 既不是朋友也不是敌人(这里不用管是不是间接朋友) 是敌人关系,同时是间接朋友关系 是单纯的敌人关系,(表示,不是间接朋友关系)    阅读全文
posted @ 2019-03-22 21:47
青山新雨
阅读(244)
评论(0)
推荐(0)
        
            
        
        
摘要:        
#include #include #include #include using namespace std; const int maxn = 2e5 + 1000; char s[maxn], str[maxn]; int len1, len2, p[maxn], ans; void init(){ str[0] = '#'; str[1] = '#'; for (...    阅读全文
posted @ 2019-03-22 20:44
青山新雨
阅读(331)
评论(0)
推荐(0)
        
            
        
        
摘要:        
#include #include #include using namespace std; const int maxn = 100; int af[maxn], in[maxn], n; struct node{ int l, r; }tree[maxn]; int biuld(int al, int ar, int bl, int br){ if (al > ar)re...    阅读全文
posted @ 2019-03-22 20:08
青山新雨
阅读(107)
评论(0)
推荐(0)
        

 浙公网安备 33010602011771号
浙公网安备 33010602011771号