网站首页 站内搜索

搜索结果

查询Tags标签: inRoot,共有 2条记录
  • 1151 LCA in a Binary Tree (30 分)(树的遍历,LCA算法)

    The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a binary tree, you are supposed to find their LCA. Input Specification: Each input file contains one test …

    2022/2/26 12:52:44 人评论 次浏览
  • 【PAT】1020 Tree Traversals (25 分)

    #include <iostream> #include <vector> #include <queue> using namespace std; struct node {int data;int lchild,rchild; };vector<int> post,in; vector<node> T;int t_index=0; int lca(int inl,int inr,int postRoot){if(inl>inr…

    2022/1/30 23:37:52 人评论 次浏览
扫一扫关注最新编程教程