码迷,mamicode.com
首页 >  
搜索关键字:element traversal    ( 13647个结果
【LeetCode】Single Number II
题目 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it wit...
分类:其他好文   时间:2014-07-23 00:13:17    阅读次数:331
Leet code —Jump Game
问题描述: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determin...
分类:其他好文   时间:2014-07-23 00:04:37    阅读次数:216
leetcode第一刷_Binary Tree Inorder Traversal
递归实现当然太简单,也用不着为了ac走这样的捷径吧。。非递归实现还挺有意思的。树的非递归遍历一定要借助栈,相当于把原来编译器做的事情显式的写出来。对于中序遍历,先要訪问最左下的节点,一定是进入循环后,不断的往左下走,走到不能走为止,这时候,能够从栈中弹出訪问的节点,相当于“左根右”过程的“根”,然后...
分类:其他好文   时间:2014-07-22 23:39:17    阅读次数:296
[leetcode]Remove Duplicates from Sorted Array
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new lengt...
分类:其他好文   时间:2014-07-22 22:48:14    阅读次数:224
min_element()与max_element()
algorithm之min_element()与max_element()...
分类:其他好文   时间:2014-07-22 14:17:49    阅读次数:172
LeetCode:Single Number II
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:其他好文   时间:2014-07-22 00:28:38    阅读次数:209
【leetcode刷题笔记】Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu...
分类:其他好文   时间:2014-07-22 00:12:36    阅读次数:156
【leetcode刷题笔记】Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu...
分类:其他好文   时间:2014-07-22 00:09:37    阅读次数:151
C++ Binary Tree Traversal
关于二叉树的遍历有很多的方法, 下面介绍两个经典的遍历算法: BFS和DFS。一个是深度优先遍历, 一个是广度有优先遍历。 这两种遍历算法均属于盲目的遍历算法, 一般而言, 启发式的遍历搜索算法比较好一些。 。 关于各种遍历算法的对比, 将会在后面逐一提及。 这里不在赘述。 由于树是一个非线性的数据结构, 显然不能像linked list , 或者Array那样通过从头像最末尾移动去实现遍历每一...
分类:编程语言   时间:2014-07-20 23:14:21    阅读次数:387
C++ Level-Order Traversal
这里讲讲对binary Tree 进行level order Traversal.。 即BF traversal(广度优先遍历)。即首先, 访问根节点F, 打印出数据。 接着访问level 1的所有节点, 即D, J。 访问完level1之后, 访问level2, 即B, E, G , K 等等一次访问下去, 直至遍历完所有的节点。   BFS遍历的思路很简单, 但是当我们编程实现的时候,...
分类:编程语言   时间:2014-07-20 23:11:21    阅读次数:344
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!