码迷,mamicode.com
首页 >  
搜索关键字:preorder traversal    ( 1851个结果
107. Binary Tree Level Order Traversal II
https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ 层序遍历,然后把结果反一下返回值就可以了 最后一步有问题,reverse()函数没有返回值,应该使用 res[::-1] Runtime: 44 ms, faste ...
分类:其他好文   时间:2019-01-29 00:35:30    阅读次数:141
递归 回调 迭代 遍历 闭包 区别
表示“重复”这个含义的词有很多, 比如循环(loop), 递归(recursion), 遍历(traversal), 迭代(iterate).循环算是最基础的概念, 凡是重复执行一段代码, 都可以称之为循环. 大部分的递归, 遍历, 迭代, 都是循环. 递归是重复调用函数自身实现循环。 迭代是函数内 ...
分类:其他好文   时间:2019-01-27 21:46:28    阅读次数:214
PTA-1020——Tree Traversals
题目: Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed t ...
分类:其他好文   时间:2019-01-27 19:03:00    阅读次数:168
BFS总结
1. Queue Python中,使用collections.deque,双端队列 2. 图的BFS BFS中可能用到的HashSet(C++: unordered_map, Python: dict) 常用邻接表存储。邻接矩阵太大了... 邻接表定义: 1. 自定义的方法,更加工程化。所以在面试中 ...
分类:其他好文   时间:2019-01-26 21:41:02    阅读次数:201
二叉树遍历
后序递归: ...
分类:其他好文   时间:2019-01-21 22:55:26    阅读次数:178
栈和递归的关系 144:Binary Tree Preorder Traversal
前序遍历:根左右 中序遍历:左根右 ...
分类:其他好文   时间:2019-01-16 23:22:08    阅读次数:255
102. Binary Tree Level Order Traversal
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 ...
分类:其他好文   时间:2019-01-13 16:12:42    阅读次数:196
783. Minimum Distance Between BST Nodes - Easy
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa ...
分类:其他好文   时间:2019-01-10 17:45:12    阅读次数:115
【面试必备】手撕代码,你怕不怕?
有了我们的消费者和生产者代码,我们需要来验证一下它们的正确性,照常理来说我们直接创建一些消费者和生产者的线程让它们执行就可以了啊,但是为了“加分”考虑呢,我们还是使用线程池吧..也不是特别复杂:
分类:其他好文   时间:2019-01-10 12:05:03    阅读次数:174
314. Binary Tree Vertical Order Traversal - Medium
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the sam ...
分类:其他好文   时间:2019-01-10 10:50:58    阅读次数:114
1851条   上一页 1 ... 27 28 29 30 31 ... 186 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!