码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
105. Construct Binary Tree from Preorder and Inorder Traversal
 Leetcode Tree Depth-first Search Given preorder and inorder traversal of a tree, construct... ...
分类:其他好文   时间:2019-10-02 21:08:04    阅读次数:100
LeetCode 98. Validate Binary Search Tree
题意:给出头结点,让你判断这颗树是不是二叉搜索树。 思路: 很显然,对于一棵二叉搜索树,其左右子树肯定也是二叉搜索树; 因此,递归思路:如果左右子树都是BST,并且该根结点也符合规律(小于左子树的最小结点,小于右子树的最大结点) 递归边界:如果是空节点,那么返回true; 我在实现的时候偷了一点懒; ...
分类:其他好文   时间:2019-10-02 21:05:09    阅读次数:131
LeetCode_111. Minimum Depth of Binary Tree
111. Minimum Depth of Binary Tree Easy Easy Easy Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the short ...
分类:其他好文   时间:2019-10-02 17:02:53    阅读次数:77
Binary-Search
输入:一个已经排好序的待搜索数组array_to_search,需要查找的数number,查找边界left、right。 输出:number在array_to_search中的位置,若未找到,输出 1。 实现思路 1. 将数组的中间元素array_to_search[middle]与待查找数numb ...
分类:其他好文   时间:2019-10-02 11:01:45    阅读次数:89
LeetCode_110. Balanced Binary Tree
110. Balanced Binary Tree Easy Easy Easy Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is d ...
分类:其他好文   时间:2019-10-02 10:23:19    阅读次数:88
LeetCode_108. Convert Sorted Array to Binary Search Tree
fasffasfa 108. Convert Sorted Array to Binary Search Tree Easy Easy Easy Given an array where elements are sorted in ascending order, convert it to a ...
分类:其他好文   时间:2019-10-01 18:54:01    阅读次数:108
LeetCode_107. Binary Tree Level Order Traversal II
107. Binary Tree Level Order Traversal II Easy Easy Easy Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, fr ...
分类:其他好文   时间:2019-10-01 12:19:17    阅读次数:104
LeetCode 96. Unique Binary Search Trees
题意:给定一个数n,求出1~n,所有二叉树的个数; 在LeetCode 95中,要你求出所有二叉树,并返回结点,题解见:https://www.cnblogs.com/yy-1046741080/p/11594454.html。 原来我就想用直接递归,来求出结点个数的,结果发现TE; 在近期了解了D ...
分类:其他好文   时间:2019-09-30 20:05:16    阅读次数:72
四种排序算法与二分查找
1. 冒泡排序 2. 插入排序 3. 选择排序 4. 快速排序 5. 二分查找 ...
分类:编程语言   时间:2019-09-30 17:01:02    阅读次数:91
LeetCode_104. Maximum Depth of Binary Tree
104. Maximum Depth of Binary Tree Easy Easy Easy Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longe ...
分类:其他好文   时间:2019-09-29 15:39:53    阅读次数:112
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!