前进的道路不是一帆风顺的,要随时迎接挑战,敢于战胜困难!

坚持一下,找人聊聊天,释放一些压力!

 

08 2010 档案

判断整数序列是不是二元查找树的后序遍历结果
摘要: #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; +...阅读全文

posted @ 2010-08-11 16:29 山径山精 阅读(61) | 评论 (0) 编辑

查找最小的k个元素
摘要: 算法中使用到了堆,即stl中的multiset。#include <iostream>#include <vector>#include <set>using namespace std;typedef multiset<int, greater<int>> IntHeap;void FindKLeastNumbers(const vec...阅读全文

posted @ 2010-08-11 15:25 山径山精 阅读(77) | 评论 (0) 编辑

在二元树中查找和为某一值的所有路径
摘要: #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...阅读全文

posted @ 2010-08-11 14:25 山径山精 阅读(47) | 评论 (0) 编辑

求子数组的最大和
摘要: #include <iostream>using namespace std;bool FindGreatestSumOfSubArray(int *pData, unsigned int nLength, int &nGreatestSum){if (!pData||0==nLength){return false;}int nCurrentSum=nGreatestSum=...阅读全文

posted @ 2010-08-11 13:34 山径山精 阅读(48) | 评论 (0) 编辑

把二元查找树转变成排序的双向链表
摘要: #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...阅读全文

posted @ 2010-08-11 12:59 山径山精 阅读(169) | 评论 (0) 编辑

编写String类的构造函数,析构函数,赋值函数
摘要: #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*...阅读全文

posted @ 2010-08-10 17:40 山径山精 阅读(150) | 评论 (0) 编辑

设计包含min函数的栈(源码)
摘要: 采用两个双端队列实现,一个存数据,一个是辅助栈,存第一个栈的最小元素的地址,实现技巧在于辅助栈存放的是第一个栈的最小元素的地址,难度在于使用模板实现。#include <deque>#include <assert.h>#include <iostream>using namespace std;template <typename T>class ...阅读全文

posted @ 2010-08-10 13:53 山径山精 阅读(170) | 评论 (0) 编辑

自己写的大整数乘法C++程序,请指正。
摘要: #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...阅读全文

posted @ 2010-08-09 18:02 山径山精 阅读(166) | 评论 (0) 编辑

DLL中导出函数的两种方式(dllexport与.def文件)
摘要: DLL中导出函数的声明有两种方式:一种方式是:在函数声明中加上__declspec(dllexport);另外一种方式是:采用模块定义(.def)文件声明,(.def)文件为链接器提供了有关被链接程序的导出、属性及其他方面的信息。方式一:在函数声明中加上__declspec(dllexport)/// 在动态链接库程序中/// 声明动态链接库(**.dll)的对外接口函数TestFuctionex...阅读全文

posted @ 2010-08-04 13:31 山径山精 阅读(560) | 评论 (0) 编辑

导航

统计

公告