摘要: #include <iostream>using namespace std;bool verifySquenceOfBST(int squence[], int length){if (squence==NULL||length<=0){return false;}int root=squence[length-1];int i=0;for(; i<length-1; +...
阅读全文
摘要: 算法中使用到了堆,即stl中的multiset。#include <iostream>#include <vector>#include <set>using namespace std;typedef multiset<int, greater<int>> IntHeap;void FindKLeastNumbers(const vec...
阅读全文
摘要: #include <iostream>#include <vector>using namespace std;struct BinaryTreeNode{int m_nValue;BinaryTreeNode* m_pLeft;BinaryTreeNode* m_pRight;};int count=0; //print controlvoid FindPath(Bina...
阅读全文
摘要: #include <iostream>using namespace std;bool FindGreatestSumOfSubArray(int *pData, unsigned int nLength, int &nGreatestSum){if (!pData||0==nLength){return false;}int nCurrentSum=nGreatestSum=...
阅读全文
摘要: #include <iostream>#include <time.h>#define MAX_NUM 10using namespace std;struct BSTreeNode {int m_nValue;BSTreeNode *m_pLeft;BSTreeNode *m_pRight;};int count=0;void AddTree(BSTreeNode** T...
阅读全文
摘要: #include <iostream>using namespace std;class String{public:String(const char* str=NULL);String(const String& other);~String(void);String & operator =(const String& other);const char*...
阅读全文
摘要: 采用两个双端队列实现,一个存数据,一个是辅助栈,存第一个栈的最小元素的地址,实现技巧在于辅助栈存放的是第一个栈的最小元素的地址,难度在于使用模板实现。#include <deque>#include <assert.h>#include <iostream>using namespace std;template <typename T>class ...
阅读全文
摘要: #include <iostream>using namespace std;int multi(const int a[], const int b[], int c[], const int len){for (int k=0; k<2*len-1; k++){for (int i=0; (i<k+1)&&(i<len); i++){if (k-i...
阅读全文
摘要: DLL中导出函数的声明有两种方式:一种方式是:在函数声明中加上__declspec(dllexport);另外一种方式是:采用模块定义(.def)文件声明,(.def)文件为链接器提供了有关被链接程序的导出、属性及其他方面的信息。方式一:在函数声明中加上__declspec(dllexport)/// 在动态链接库程序中/// 声明动态链接库(**.dll)的对外接口函数TestFuctionex...
阅读全文