码迷,mamicode.com
首页 >  
搜索关键字:traversal    ( 1649个结果
【PAT 甲级】1151 LCA in a Binary Tree (30 分)
题目描述 The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a ...
分类:其他好文   时间:2019-02-16 15:39:54    阅读次数:191
[leetcode] Vertical Order Traversal of a Binary Tree
1. Traverse the binary tree, store {x,y,val} for every node in records; 2. Sort the records of {x,y,val} for all nodes by increasing x, decreasing y, ...
分类:其他好文   时间:2019-02-12 21:45:45    阅读次数:133
PAT 甲级 1086 Tree Traversals Again
https://pintia.cn/problem-sets/994805342720868352/problems/994805380754817024 An inorder binary tree traversal can be implemented in a non-recursive w ...
分类:其他好文   时间:2019-02-12 13:16:46    阅读次数:110
LeetCode 589 N-ary Tree Preorder Traversal 解题报告
题目要求 Given an n-ary tree, return the preorder traversal of its nodes' values. 题目分析及思路 题目给出一棵N叉树,要求返回结点值的前序遍历。可以使用递归的方法做。因为是前序遍历,所以最开始就加入根结点的值。 python代 ...
分类:其他好文   时间:2019-02-10 10:55:16    阅读次数:144
[LeetCode 987] Vertical Order Traversal of a Binary Tree
Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respective ...
分类:其他好文   时间:2019-02-10 10:54:33    阅读次数:306
BFS - 20190206
1.二叉树 BFS 2.拓扑排序 重点 BFS 3.棋盘上的宽搜 BFS 图的遍历 层级遍历,由点及面,拓扑排序,简单图的最短路径 如果题目问最短路径:可能是BFS或者DP, 最长路径:DFS queue 的数组实现 1.二叉树的BFS https://www.lintcode.com/proble ...
分类:其他好文   时间:2019-02-07 09:36:35    阅读次数:178
LeetCode-144-Binary Tree Preorder Traversal
算法描述: Given a binary tree, return the preorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iter ...
分类:其他好文   时间:2019-02-06 18:35:55    阅读次数:109
LeetCode-105-Construct Binary Tree from Preorder and Inorder Traversal
算法描述: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For exa ...
分类:其他好文   时间:2019-02-03 11:08:11    阅读次数:193
LeetCode-106-Construct Binary Tree from Inorder and Postorder Traversal
算法描述: Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For ex ...
分类:其他好文   时间:2019-02-03 10:41:35    阅读次数:198
LeetCode-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 t ...
分类:其他好文   时间:2019-02-03 10:40:28    阅读次数:184
1649条   上一页 1 ... 20 21 22 23 24 ... 165 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!