码迷,mamicode.com
首页 >  
搜索关键字:traversal    ( 1649个结果
非递归实现树的前序遍历
/*binary-tree-postorder-traversal*/ /***************************/ /* Given a binary tree, return the postorder traversal of its nodes' values. For exa... ...
分类:其他好文   时间:2017-08-01 17:54:14    阅读次数:145
树的遍历
从二叉树的根节点出发,节点的遍历分为三个主要步骤:对当前节点进行操作(称为“访问”节点,或者根节点)、遍历左边子节点、遍历右边子节点。访问节点顺序的不同也就形成了不同的遍历方式。需要注意的是树的遍历通常使用递归的方法进行理解和实现,在访问元素时也需要使用递归的思想去理解。实际实现中对于前序和中序遍历 ...
分类:其他好文   时间:2017-08-01 15:46:13    阅读次数:123
103. Binary Tree Zigzag Level Order Traversal
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:其他好文   时间:2017-07-31 15:47:27    阅读次数:120
【LeetCode-面试算法经典-Java实现】【106-Construct Binary Tree from Inorder and Postorder Traversal(构造二叉树II)】
【106-Construct Binary Tree from Inorder and Postorder Traversal(通过中序和后序遍历构造二叉树)】 【LeetCode-面试算法经典-Java实现】【全部题目文件夹索引】 原题 Given inorder and postorder tr ...
分类:编程语言   时间:2017-07-30 16:54:59    阅读次数:115
读书笔记 - js高级程序设计 - 第十一章 DOM扩展
对DOM的两个主要的扩展 Selectors API HTML5 Element Traversal 元素遍历规范 querySelector var body = document.querySelector("body"); var myDiv = document.querySelector( ...
分类:Web程序   时间:2017-07-27 20:08:36    阅读次数:186
Binary tree preorder traversal
不同的方法, 递归出口, 加入结果容器的顺序和递归的顺序 遍历 递归调用: 分治法 分治法的步骤, 递归出口, 先分-> 操作, 再合->操作, 返回 ...
分类:其他好文   时间:2017-07-26 00:09:32    阅读次数:162
230. Kth Smallest Element in a BST
题目: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ B ...
分类:其他好文   时间:2017-07-25 21:05:37    阅读次数:180
[LeetCode] Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:其他好文   时间:2017-07-23 19:49:20    阅读次数:172
LeetCode 94:Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Note: Recu ...
分类:其他好文   时间:2017-07-22 21:11:59    阅读次数:161
107.Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:其他好文   时间:2017-07-22 19:49:38    阅读次数:122
1649条   上一页 1 ... 44 45 46 47 48 ... 165 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!