题目:Given a binary tree, return the preorder traversal
of its nodes' values.
此题即为二叉树的前序遍历,递归的方法很简单:先节点再左子树再右子树;迭代的方法可以利用栈存储来完成遍历过程。
补充递归与迭代的区别:许多问题是以递归的形式进行解释的,这只是因为它比非递归形式更为清晰。但是,这些问题的迭代往往比递归实现效率更...
分类:
其他好文 时间:
2014-09-24 11:24:56
阅读次数:
206
#!/usr/bin/python # -*- coding:utf8 -*- import os import re def swap(path, a, b): print path file = open(path, "r").read() file = re.sub(a,b,file) #pr...
分类:
编程语言 时间:
2014-09-23 22:42:45
阅读次数:
198
原题:
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 tree {3,9,20,#,#,15,7},
3
/ 9 ...
分类:
其他好文 时间:
2014-09-23 20:29:17
阅读次数:
243
// The_Least_K_number.cpp : 定义控制台应用程序的入口点。
//数组中第k小的数,例如a[1000]中第250小的数//
#include "stdafx.h"
#include
using namespace std;
void swap(int *p, int *q)
{
int temp = *p;
*p = *q;
*q = temp;
}
int ...
分类:
其他好文 时间:
2014-09-23 20:14:05
阅读次数:
206
需要使用的是jsoup-1.7.3.jar包 如果需要看文档我下载请借一步到官网:http://jsoup.org/
这里贴一下我用到的 Java工程的测试代码
package com.javen.Jsoup;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Docu...
分类:
Web程序 时间:
2014-09-22 22:57:33
阅读次数:
295
euca_conf --version 查看桉树版本euca_conf --list-clouds 查看云控器相关信息euca_conf --list-clusters 查看集群控制器相关信息euca_conf --list-scs 查看存储控制器相关信息euca_conf --list-nodes...
分类:
其他好文 时间:
2014-09-22 20:49:33
阅读次数:
200
/etc/fstab文件分析 前面说新建的分区在系统重启之后就会失效,要想永久生效,需要将其写入/etc/fstab文件 一、/etc/fstab文件格式:6个组成部分 物理分区名/卷标 挂载点 文件系统 缺省设置 是否检测 检测顺序UUID=6e428a... / ext4 defaults 1 1LABEL=/ / ...
分类:
其他好文 时间:
2014-09-22 20:33:53
阅读次数:
172
An architecture for an extended multiprocessor (XMP) computer system is provided. The XMP computer system includes multiple SMP nodes. Each SMP node i...
分类:
其他好文 时间:
2014-09-22 20:22:43
阅读次数:
234
Source Reference: wix help document --WiX Toolset LicenseUsing Patch Creation PropertiesA patch contains the differences between one or more pairs of ...
分类:
其他好文 时间:
2014-09-22 16:38:12
阅读次数:
271
[leetcode]Given a binary tree, return the preorder traversal of its nodes' values....
分类:
其他好文 时间:
2014-09-22 13:38:03
阅读次数:
215