简述树的深度优先及广度优先遍历算法,并说明非递归实现。原题出自百度的笔试:当时我看到这个题目的时候,已经完全记不得非递归算法该怎么实现了,后来查阅了一下,要用到两个辅助的数据结构:深度优先遍历--->栈;广度优先遍历--->队列;这里以二叉树为例来实现。import
java.util.ArrayD...
分类:
其他好文 时间:
2014-05-20 02:33:07
阅读次数:
425
1 data segment 2 ;定义字符串缓冲区 3 ;MAXLEN 表示允许输入的最大字符数量
4 ;ACTLEN 表示实际输入的数量 5 ;STR 用于存储输入的字符串 6 ;以下面为例,允许最大输入5个字符,如果STR后面...
分类:
其他好文 时间:
2014-05-20 02:16:42
阅读次数:
370
import java.awt.Dimension;import
java.io.File;import java.io.FileReader;import java.util.ArrayList;import
java.util.List;import javax.swing.JFrame;imp...
分类:
其他好文 时间:
2014-05-20 01:34:34
阅读次数:
211
如下面所示,同时导入这两个,会提示其中一个与另一个产生冲突。1 import
android.view.View.OnClickListener;2 import
android.content.DialogInterface.OnClickListener;其实,当我们用某个Listener时,不...
分类:
移动开发 时间:
2014-05-20 01:19:27
阅读次数:
358
1.写了ToDoDataContext类,实现数据存储 在实例化类中,忘记检查 数据库
是否已存在,导致一直报错: “System.Data.SqlServerCe.SqlCeException”类型的未经处理的异常在
Microsoft.Phone.Interop.ni.dll 中发生...
分类:
其他好文 时间:
2014-05-20 00:27:40
阅读次数:
365
Python load json file with UTF-8 BOM header -
Stack Overflow 12 down voteacceptedYou can open with codecs:import jsonimport
codecsjson.load(codecs.ope...
分类:
编程语言 时间:
2014-05-19 23:02:20
阅读次数:
507
第一步:建立所有页面的基类PageBase.csusing System;using
System.Data;using System.Configuration;using System.Web;using
System.Web.Security;using System.Web.UI;using...
分类:
其他好文 时间:
2014-05-19 22:20:12
阅读次数:
368
1 #include "iostream" 2 #include "string" 3 using
namespace std; 4 5 typedef struct node{ 6 string data; 7 struct node *next; 8
node(str...
分类:
其他好文 时间:
2014-05-19 22:08:01
阅读次数:
368
1 package main //main函数 2 import "fmt"
//相当于#include 3 func main() { 4 ar := [10]int{9, 8, 6, 4, 2, 7, 1, 3, 0, 5} 5
num := len(ar) //...
分类:
其他好文 时间:
2014-05-17 14:25:49
阅读次数:
272
1.Scatter/Gather I/Oa single system call to
read or write data between single data stream and multiple buffersThis type of
I/O is so named because the...
分类:
系统相关 时间:
2014-05-17 14:17:55
阅读次数:
571