The order of a Tree Problem Description As we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisel ...
分类:
编程语言 时间:
2019-09-14 13:27:43
阅读次数:
101
Question For an undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all poss ...
分类:
其他好文 时间:
2019-09-14 00:13:58
阅读次数:
103
题目连接: https://leetcode-cn.com/problems/find-duplicate-subtrees/ 题目大意: 中文题 具体思路: 将每一颗子树转换成字符串,然后通过unordered_map去重即可(map的速度较慢) AC代码: ...
分类:
其他好文 时间:
2019-09-13 17:50:19
阅读次数:
93
Binary Tree Traversals Problem Description A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint bin ...
分类:
其他好文 时间:
2019-09-13 17:43:06
阅读次数:
84
题目连接: https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/ 题目大意: 中文题目 AC代码: ...
分类:
其他好文 时间:
2019-09-13 17:33:56
阅读次数:
111
Leetcode之分治法专题-654. 最大二叉树(Maximum Binary Tree) 给定一个不含重复元素的整数数组。一个以此数组构建的最大二叉树定义如下: 通过给定的数组构建最大二叉树,并且输出这个树的根节点。 示例 : 提示: 分别找l到r区间里的最大值,然后再构造其左右的子树就ok了。 ...
分类:
其他好文 时间:
2019-09-13 11:03:27
阅读次数:
112
一、基本介绍 BST: (Binary Sort(Search) Tree), 对于二叉排序树的任何一个非叶子节点,要求左子节点的值比当前节点的值 小,右子节点的值比当前节点的值大。 说明:如果有相同的值,可以将该节点放在左子节点或右子节点 二、二叉排序树的删除 1)删除叶子节点 (比如:2, 5, ...
分类:
编程语言 时间:
2019-09-11 22:24:10
阅读次数:
124
一、基本介绍 1)平衡二叉树也叫平衡二叉搜索树(Self-balancing binary search tree)又被称为AVL树, 可以保证查询效率较高。 2)具有以下特点:它是一 棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树。 3)平衡二叉树的常用实现方 ...
分类:
其他好文 时间:
2019-09-11 21:30:27
阅读次数:
95
Given a 2D binary matrix filled with 0's and 1's,find the largest square containing only 1's and return its area. Input: 1 0 1 0 01 0 1 1 11 1 1 1 11 ...
分类:
其他好文 时间:
2019-09-11 20:11:23
阅读次数:
106
java中的进制转换及转换函数 java中的进制转换及转换函数 java中的进制转换及转换函数 java中的进制转换及转换函数 转自:https://blog.csdn.net/V0218/article/details/74945203 Java的进制转换 进制转换原理 十进制 转 二进制: 原理 ...
分类:
编程语言 时间:
2019-09-10 01:20:50
阅读次数:
102