码迷,mamicode.com
首页 >  
搜索关键字:traverse    ( 100个结果
日志解析(三) 文件合并
首先遍历文件夹下所有文件,然后再进行合并遍历文件def traverse_dir(file_path) if File.directory? file_path Dir.foreach(file_path) do |file| if file !="." and file !=".." traver...
分类:其他好文   时间:2015-03-05 18:43:22    阅读次数:168
Leetcode: Binary Search Tree Iterator
We essentailly do an in-order traversal (中序遍历) of the tree since the in-order traversal results in a sorted list of node items.1 def traverse_binary_t...
分类:其他好文   时间:2015-02-26 06:28:30    阅读次数:155
Leetcode_Sum Root to Leaf Numbers
递归实现,深度遍历,记录每一条路径。 class Solution { public: int sumNumbers(TreeNode *root) { if(root==nullptr) return 0; vector> result; vector path; traverse(root,result,path); int n=result.size();...
分类:其他好文   时间:2015-02-10 13:20:24    阅读次数:141
Bucket Sort
1. Setup an array of initially empty "buckets".2. Scatter: Traverse the original array and extract each element into its bucket.3. Sort each non-empty...
分类:其他好文   时间:2015-02-03 06:59:23    阅读次数:201
Leetcode#113 Path Sum II
原题地址二叉树基本操作——遍历题目没说数字都是正数,所以没法剪枝,只能全部遍历一遍。代码: 1 vector > res; 2 3 void traverse(TreeNode *root, vector ans, int sum) { 4 if (!root) 5 retur...
分类:其他好文   时间:2015-01-30 14:34:35    阅读次数:226
Ruby中的遍历指定目录的文件方法
在ruby中我们要实现遍历指定目录的方法,网上的方法也非常之多,我们可以拿来参考参考,如下边的traverse.rb文件内容所示:#!/usr/bin/ruby deftraverse(filepath) ifFile.directory?(filepath) puts"Dirs:"+filepath Dir.foreach(filepath)do|filename| iffilename!="."andfil..
分类:其他好文   时间:2015-01-09 19:32:32    阅读次数:133
Python学习笔记_字典(Dict)_遍历_不同方法_性能测试对比
今天专门把python的字典各种方法对比测试了一下性能效果.测试代码如下: 1 def dict_traverse(): 2 from time import clock 3 my_dict = {'name': 'Jim', 'age': '20', 'height': '180c...
分类:编程语言   时间:2015-01-06 17:48:14    阅读次数:180
node to traverse cannot be null!
java.lang.IllegalArgumentException: node to traverse cannot be null! org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:55...
分类:其他好文   时间:2014-11-04 12:38:16    阅读次数:201
UVA 810 筛子难题(BFS)
The three-by-three array in Figure 1 is a maze. A standard six-sided die is needed to traverse the maze (the layout of a standard six--sided die is shown in Figure 2). Each maze has an initial positio...
分类:其他好文   时间:2014-10-30 17:15:04    阅读次数:278
osg::NodeVisitor中计算一个节点对应的世界变换矩阵、法向量、顶点坐标
class MyNodeVisitor:public osg::NodeVisitor{pulic: MyNodeVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} void apply(osg::Geo...
分类:其他好文   时间:2014-10-28 15:12:36    阅读次数:442
100条   上一页 1 ... 7 8 9 10 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!