码迷,mamicode.com
首页 >  
搜索关键字:traversal    ( 1649个结果
LeetCode144二叉树前序遍历
题目链接 https://leetcode-cn.com/problems/binary-tree-preorder-traversal/description/ 题解一:递归 // Problem: LeetCode 144 // URL: https://leetcode-cn.com/prob ...
分类:其他好文   时间:2020-07-13 00:00:50    阅读次数:90
LeetCode 102 二叉树的层序遍历
题目描述链接:https://leetcode-cn.com/problems/binary-tree-level-order-traversal/ 解题思路:参考官方题解,解题思路如下:对于二叉树的层序遍历,首先应该考虑到的数据结构便是队列,利用队列现进先出的特性,可以很方便的解决此题。 (1)根 ...
分类:其他好文   时间:2020-07-12 20:29:04    阅读次数:65
429. N-ary Tree Level Order Traversal
Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversa ...
分类:其他好文   时间:2020-07-10 11:20:42    阅读次数:63
二叉树基础
#树(Tree)的基本概念 ####节点、根节点、父节点、子节点、兄弟节点;节点、根节点、父节点、子节点、兄弟节点; 一棵树可以没有任何节点,称为空树 一棵树可以只有 1 个节点,也就是只有根节点 子树、左子树、右子树; **节点的度(degree):**子树的个数; **树的度:**所有节点度中的 ...
分类:其他好文   时间:2020-07-09 00:50:24    阅读次数:70
1008. Construct Binary Search Tree from Preorder Traversal
package LeetCode_1008 /** * 1008. Construct Binary Search Tree from Preorder Traversal * https://leetcode.com/problems/construct-binary-search-tree-fr ...
分类:其他好文   时间:2020-07-06 23:57:45    阅读次数:88
binary-tree-preorder-traversal 迭代法求解二叉树前序遍历
题目: 求给定的二叉树的前序遍历。 例如: 给定的二叉树为{1,#,2,3}, 1 2 / 3 返回:[1,2,3] 代码: 1 /** 2 * struct TreeNode { 3 * int val; 4 * struct TreeNode *left; 5 * struct TreeNode ...
分类:其他好文   时间:2020-07-06 17:50:18    阅读次数:44
循环、递归、遍历、迭代的区别
表示“重复”这个含义的词有很多, 比如循环(loop), 递归(recursion), 遍历(traversal), 迭代(iterate). 循环算是最基础的概念, 凡是重复执行一段代码, 都可以称之为循环. 大部分的递归, 遍历, 迭代, 都是循环. 递归是重复调用函数自身实现循环。迭代是函数内 ...
分类:其他好文   时间:2020-06-27 10:09:13    阅读次数:50
Web For Pentester1 -Directory traversal
Example 1 源码: <?php $UploadDir = '/var/www/files/'; if (!(isset($_GET['file']))) die(); $file = $_GET['file']; $path = $UploadDir . $file; if (!is_fil ...
分类:Web程序   时间:2020-06-25 17:18:00    阅读次数:61
1086 Tree Traversals Again (25分)(树的重构与遍历)
1086 Tree Traversals Again (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that wh ...
分类:其他好文   时间:2020-06-19 23:19:08    阅读次数:62
102. 二叉树的层序遍历(队列+BFS+结构体)
题目描述 leetcode - 102:https://leetcode-cn.com/problems/binary-tree-level-order-traversal/ 解题关键 队列 BFS 结构体 碎碎念 这道题可以不用结构体,在while循环里面加一个for循环来遍历某一层的节点。但是很 ...
分类:其他好文   时间:2020-06-19 01:10:53    阅读次数:67
1649条   上一页 1 2 3 4 5 6 ... 165 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!