码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
【树】翻转二叉树
题目链接:https://leetcode-cn.com/problems/invert-binary-tree/ 思路一:递归 将左右结点进行交换,递归的对左右节点的左右子树进行交换 判断根结点是否为空或只有一个结点 交换根结点的左右儿子 对该结点的左右子树进行交换 1 /** 2 * Defin ...
分类:其他好文   时间:2020-04-22 20:07:19    阅读次数:79
1127 ZigZagging on a Tree
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino ...
分类:其他好文   时间:2020-04-22 12:51:03    阅读次数:65
路径总和
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. N ...
分类:其他好文   时间:2020-04-22 10:01:42    阅读次数:64
[centos同步数据库]CentOS7, mysql主从同步数据库配置
? ? 最近免费试用了一下云服务器,然后在两台服务器上安装了Mysql并搭建了主从同步数据库。mysql数据库的安装,大家可以去查看我的另一篇博客文章,下面为大家介绍搭建步骤及原理。 ? ? mysql主节点即master节点在每次对数据库执行操作后会将操作写入到本地的二进制日志(binary lo ...
分类:数据库   时间:2020-04-22 09:44:27    阅读次数:506
[LeetCode in Python] 98 (M) validate binary search tree 验证二叉搜索树
题目 https://leetcode cn.com/problems/validate binary search tree/ 给定一个二叉树,判断其是否是一个有效的二叉搜索树。 假设一个二叉搜索树具有如下特征: 节点的左子树只包含小于当前节点的数。 节点的右子树只包含大于当前节点的数。 所有左子 ...
分类:编程语言   时间:2020-04-22 09:39:44    阅读次数:68
对称二叉树
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet ...
分类:其他好文   时间:2020-04-22 09:28:17    阅读次数:63
[LeetCode] 105. Construct Binary Tree from Preorder and Inorder Traversal
从前序与中序遍历序列构造二叉树。题意是给一个二叉树的前序遍历和中序遍历,请根据这两个遍历,把树构造出来。例子, For example, given preorder = [3,9,20,15,7] inorder = [9,3,15,20,7] Return the following binar ...
分类:其他好文   时间:2020-04-21 13:31:31    阅读次数:65
Linux - 常用命令
Linux系统文件结构 /bin: bin是Binary的缩写, 这个目录存放着最经常使用的命令。 /boot: 这里存放的是启动Linux时使用的一些核心文件,包括一些连接文件以及镜像文件。 /dev : dev是Device(设备)的缩写, 该目录下存放的是Linux的外部设备,在Linux中访 ...
分类:系统相关   时间:2020-04-21 13:11:19    阅读次数:79
二叉树的层次遍历
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree [3 ...
分类:其他好文   时间:2020-04-21 09:51:36    阅读次数:66
[LeetCode] 1008. Construct Binary Search Tree from Preorder Traversal
先序遍历构造二叉搜索树。题目即是题意,例子, Input: [8,5,1,7,10,12] Output: [8,5,10,1,7,null,12] 这个题可以迭代或递归都可以做,我这里暂时先给出递归的做法。因为是BST所以会简单很多,首先input的首个元素是树的根节点,接着写一个helper函数 ...
分类:其他好文   时间:2020-04-21 09:34:03    阅读次数:63
共12390条   上一页 1 ... 54 55 56 57 58 ... 1239 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!