摘要: 题目描述: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the near 阅读全文
posted @ 2019-03-12 20:01 GuoXinxin 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root) 阅读全文
posted @ 2019-03-12 17:21 GuoXinxin 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 升序数组,转二叉排序树 解题思路: 使用递归方法: 选取中间的节点作为root节点,其左侧的 阅读全文
posted @ 2019-03-12 13:27 GuoXinxin 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 最小生成树 一个连通图的生成树是一个极小的连通子图,它含有图中全部的顶点,但只有足以构成一棵树的n-1条边。 把构造连通网的最小代价生成树称为最小的生成树。(最小成本,即n个顶点,用n-1条边把一个连通图连接起来,并且使得权值的和最小) 经典算法:普里姆算法和克鲁斯卡尔算法 一、普里姆算法(Prim 阅读全文
posted @ 2019-03-12 10:36 GuoXinxin 阅读(678) 评论(0) 推荐(0) 编辑