摘要:
1 // 面试题7:重建二叉树 2 // 题目:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输 3 // 入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1, 4 // 2, 4, 7, 3, 5, 6, 8}和中序遍历序列{4, 7, 2, 1, 5, 3, 阅读全文
摘要:
#include"iostream" #include"stdio.h" #include"stack" using namespace std; struct ListNode { int value; ListNode *pNext; }; ListNode* CreatListNode(int 阅读全文
摘要:
1 #include"iostream" 2 #include"stdio.h" 3 using namespace std; 4 5 int* ArrayMerge(int *a,int aLen,int *b,int bLen) 6 { 7 int aIndex=aLen-1,bIndex=bL 阅读全文
摘要:
利用STL: 1 #include"iostream" 2 #include"stdio.h" 3 #include"algorithm" 4 using namespace std; 5 6 string ReplaceBlank(string src) 7 { 8 if(src.find(" " 阅读全文
摘要:
1 // 面试题4:二维数组中的查找 2 // 题目:在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按 3 // 照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个 4 // 整数,判断数组中是否含有该整数。 5 6 #include <cstdio> 7 8 b 阅读全文
摘要:
1 #include"iostream" 2 #include"stdio.h" 3 using namespace std; 4 typedef long long ll; 5 6 ll f(ll n) 7 { 8 ll fn=0,ntemp=n; 9 ll step; 10 for(step=1 阅读全文
摘要:
1 #include"iostream" 2 #include"string" 3 #include"vector" 4 #include"sstream" 5 #include"stdio.h" 6 using namespace std; 7 8 int main() 9 { 10 string 阅读全文
摘要:
1 #include"iostream" 2 #include"string" 3 #include"string.h" 4 #include"vector" 5 #include"algorithm" 6 using namespace std; 7 8 vector<string> subStr 阅读全文
摘要:
1 #include"iostream" 2 #include"stdio.h" 3 #include"string.h" 4 #include"vector" 5 using namespace std; 6 7 const int MAXN=100005; 8 9 pair<int,string 阅读全文
摘要:
1 #include"iostream" 2 #include"stdio.h" 3 using namespace std; 4 5 void ShellSort(int *data,int left,int right) 6 { 7 int len=right-left+1; 8 int d=l 阅读全文