Two methods:1. Traverse2. Divide & Conquer 1 // Traverse: usually do not have return value 2 public class Solution { 3 public void traverse(TreeNo...
分类:
其他好文 时间:
2015-10-26 01:56:04
阅读次数:
209
简要代码
/*
* File : print binary tree road between leaf A and leaf B
* Date : 2015/8/2
* Author : jinya
* Assert A --> B
* traverse root , left , right ; left , root , right ; left , right , root...
分类:
其他好文 时间:
2015-08-02 16:54:43
阅读次数:
138
二叉树先序递归遍历 1 int PreOrderTraverse(bitree T) 2 { 3 bitree p=T; 4 if(p) 5 { 6 coutdatalchild); 8 traverse(p->rchild); 9 }...
分类:
其他好文 时间:
2015-07-30 13:05:22
阅读次数:
138
This problem has a naive idea, which is to traverse all possible pairs of two points and see how many other points fall in the line determined by them...
分类:
其他好文 时间:
2015-07-11 22:44:06
阅读次数:
133
#include
#include
#include
typedef struct Node
{
int data;//数据域
struct Node * pNext;//指针域
}NODE, * PNODE; //NODE等价于struct Node, PNODE 等价于struct Node *
//函数声明
void create_list(PNODE pHead);//创建一个动态链表
void traverse_list(PNOD...
分类:
编程语言 时间:
2015-06-30 22:10:14
阅读次数:
158
声明:// 遍历
void traverse(void (*)(T&)); //遍历,依次实施visit操作(函数指针,只读或局部性修改)
template //操作器
void traverse(VST&); //遍历,依次实施visit操作(函数对象,可全局性修改)定义:template void List::tra...
分类:
其他好文 时间:
2015-05-28 23:10:57
阅读次数:
386
对Vector元素进行遍历,将遍历结果交由传递的函数使用:template void Vector::traverse(void (*visit)(T &)) //利用函数指针机制的遍历
{ for (int i = 0; i < _size; i++) visit(_elem[i]); }template template <typenam...
分类:
其他好文 时间:
2015-05-21 15:40:28
阅读次数:
326
find the first unique character in a string and you can just traverse this string only one time. if there is no such character, just return '#' and '#' will not appear in the string, else return the ...
分类:
其他好文 时间:
2015-04-21 22:53:16
阅读次数:
167
"; traverse($sub_dir, $x + 1, $y + 1); } else { for ($i = 0; $i "; } }}$countFile = 0;function traverse2($path,...
分类:
其他好文 时间:
2015-04-13 12:38:33
阅读次数:
137
import java.util.Stack;
//二叉树三种遍历递归及非递归实现(Java)
public class Traverse {
/******************定义二叉树**************************/
private final int MAX_SIZE = 10;
//链式存储
public static class BinaryTre...
分类:
编程语言 时间:
2015-03-19 16:24:16
阅读次数:
241