My first reaction: move all A elements back by n positions, and start everything from A[0] and B[0]. But a smarter idea is to start everything from th...
分类:
其他好文 时间:
2014-07-22 00:35:36
阅读次数:
189
queue
----------------------------------------------------------------------
stack 是一种配接器(adapter),以某种容器作为底部结构,改变其接口,使之符合"先进先出"的特性。
SGI STL 默认以 deque 为 stack 底部结构
没有遍历行为,没有遍历器
示例:
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-07-22 00:30:38
阅读次数:
230
stack
-------------------------------------------------------------
stack 是一种配接器(adapter),以某种容器作为底部结构,改变其接口,使之符合"先进后出"的特性。
SGI STL 默认以 deque 为 stack 底部结构
没有遍历行为,没有遍历器
示例:
#include
#include
#include
#include
using names...
分类:
其他好文 时间:
2014-07-22 00:28:39
阅读次数:
212
DFS and using stack to validate candidates.class Solution {public: bool isValid(const string &s) { stack stk; for (int i = 0; i &...
分类:
其他好文 时间:
2014-07-22 00:28:34
阅读次数:
217
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Collections;
namespaceConsoleApplication4
{
classProgram
{
staticvoidMain(string[]args)
{
//值类型成功复制(复制所有的值)
int[]t={1,1..
分类:
其他好文 时间:
2014-07-21 12:46:13
阅读次数:
185
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Collections;
namespaceConsoleApplication4
{
classProgram
{
staticvoidMain(string[]args)
{
//Array类是一个抽象类
//元素的类型,数组的大..
分类:
其他好文 时间:
2014-07-21 12:32:14
阅读次数:
162
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;namespace ConsoleA...
分类:
其他好文 时间:
2014-07-21 08:07:57
阅读次数:
311
1 $.post(handleUrl, {mid:mid}, function(data)2 {3 alert('call back');4 }, 'json');非常简单的一句回调,再贴上php的处理代码:1 public function intend($mid=0)2 {3 ...
分类:
Web程序 时间:
2014-07-21 00:07:46
阅读次数:
316
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespaceConsoleApplication3
{
classProgram
{
staticvoidMain(string[]args)
{
int[][]arr=newint[3][];
arr[0]=newint[2]{1,2,};
arr[1]=newint[6]{3,4,..
分类:
其他好文 时间:
2014-07-20 23:12:43
阅读次数:
271
如下图:
这里我们实现DFS中的三种遍历方法。
相关的如下:
相关算法的介绍不再赘述。
首先对于preorder traversal 的步骤为:
其他两种算法略。
具体递归调用分析, 注意学会画stack frame的图分析。 这里不再赘述。
代码如下:
/* Binary Tree Traversal - Preorder, Inorder, Postor...
分类:
编程语言 时间:
2014-07-20 23:05:10
阅读次数:
365