摘要: 大家好!,我是yxdh 一个菜鸡, 感觉没什么好说的。 研究方向: java后端 阅读全文
posted @ 2020-03-05 21:20 yxdh 阅读(109) 评论(0) 推荐(0) 编辑
摘要: / 根据中序遍历 先序遍历构建 输出后序遍历 后序遍历为左右根 递归的返回条件中序遍历中 左子树和右子树 1. 过i将中序遍历中的树分为左子树和右子树 (i为中序遍历的根节点(需要输出的结点(每棵树都是自己 的根结点)) 2.确定左子树的start,与 end范围,同时通过先序数组找到此时的根节点( 阅读全文
posted @ 2020-03-05 19:56 yxdh 阅读(320) 评论(0) 推荐(0) 编辑
摘要: https://leetcode cn.com/problems/minimum cost to make at least one valid path in a grid/ 该题可以抽象为从左上角到右上角需要的最小花费, 求最小花费就是求最小路径 其中边权可以抽象为 0 1, 当一个点存在方向时 阅读全文
posted @ 2020-03-05 19:52 yxdh 阅读(159) 评论(0) 推荐(0) 编辑
摘要: "pat 1155 Heap Paths" 阅读全文
posted @ 2020-03-05 19:49 yxdh 阅读(126) 评论(0) 推荐(0) 编辑
摘要: "1123 Is It a Complete AVL Tree " 同类型题: pat:1066 输出AVL树最后的根结点 rebalancing is done to restore this property. :重新平衡是为了恢复这个属性 differ by at most one : 最多相 阅读全文
posted @ 2020-03-05 19:43 yxdh 阅读(104) 评论(0) 推荐(0) 编辑
摘要: "1098 Insertion or Heap Sort" 单词: 思路: 首先判断插入排序, 当找到一个点 a[i 1] a[i] , i就是不适配点 ​ 如果不适配位置后 排序序列的位置 和 未 排序的位置所有点值都相同,那么就是插入排序 ​ 否则 就是堆排序, 因为堆排序的序列后部已经排好序 阅读全文
posted @ 2020-03-05 19:42 yxdh 阅读(108) 评论(0) 推荐(0) 编辑
摘要: "1147 Heaps " 英语 思路 完全二叉树的性质 ​ 判断是否是大顶堆,小顶堆, 只需要判断父节点和子结点是否满足堆的性质 需要注意的是 if( 1) 可以输出元素, if(0)此时非 阅读全文
posted @ 2020-03-05 19:30 yxdh 阅读(94) 评论(0) 推荐(0) 编辑
摘要: "pat 1151 LCA in a Binary Tree" 起神解析很完善 暴力版 LCA方法: 关键代码: 优质博客:https://blog.csdn.net/Q_M_X_D_D_/article/details/90047735 阅读全文
posted @ 2020-03-05 19:19 yxdh 阅读(159) 评论(0) 推荐(0) 编辑