
C/C++ Algorithm
fysy0000
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
longessumSubArray DP
/*Copyright personal all reversedAuthor StevenDate 2011-06-28description: input : number array(positive and negative) in any sequence. output the sum of the longest原创 2011-06-29 18:26:00 · 459 阅读 · 0 评论 -
sizeof 内存对齐
关于sizeof()的一些思考(转载)2007-10-21 20:35文章作者:lostinmymind原始连接:http://lostinmymind.blogchina.com/index.html关键字:sizeof,字节对齐,多继承,虚拟继承,成员函数指针前向声明:siz原创 2011-07-19 20:11:14 · 622 阅读 · 0 评论 -
完全2叉树 应用
/* Name: Copyright: Author: Date: 18/07/11 16:43 Description: 一颗完全2叉树深度设为D,root深度假设为1,树中每个节点是个开关,默认开关关闭,当小球到达节点时候,如果开关关闭则原创 2011-07-18 19:37:33 · 832 阅读 · 0 评论 -
完全2叉树 小球下落 非模拟方法
#include #include #include using std::vector; using std::cin; using std::cout; using std::endl; int main() { int iHeight = 0;原创 2011-07-18 20:11:30 · 531 阅读 · 0 评论 -
C 递归排列
#include using namespace std; /* 假设数组A[N]排序 == 数组 A[n-1]每一位于 A[N]最后一个元素A【N】交换的排序 */ void Swap(int& num1,int& num2) { int iT原创 2011-07-17 15:17:36 · 506 阅读 · 0 评论 -
随机排序
#include #include using namespace std; int GetPos(int* piScr,int iStartIndex,int iEndIndex) { int iPos = iStartIndex; int iLef原创 2011-07-15 23:21:37 · 444 阅读 · 0 评论 -
子集构造 集合的子集合
#include using namespace std; #define NOT_IN 11111111 void SubAssemble(int* piScr,int iCurIndex,int iSize)//iCurIndex 可以等于 -1 因为 0的时候也有两种选择,原创 2011-07-17 19:40:06 · 599 阅读 · 0 评论 -
字符串去掉重复字符。 O(N)
#include #include #include #include #include #include using namespace std; void ProduceRandString(char* pcScr,int size) {原创 2011-07-17 12:33:15 · 598 阅读 · 0 评论 -
素数环 回溯
// MathShortestPath.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include bool IsPrim原创 2011-07-25 14:23:16 · 600 阅读 · 0 评论 -
归并排序
#include using namespace std; // low to upper void CombinSort(int* aiScr ,int iStartIndex,int iEndIndex) { if(iEndIndex - iStartInd原创 2011-07-14 21:47:31 · 352 阅读 · 0 评论 -
KMP 算法
/* Name: Copyright: Author: Date: 13/07/11 19:14 Description: */#include #include using namespace std; void InitNext(原创 2011-07-14 01:13:26 · 390 阅读 · 0 评论 -
字符串周期 KMP求解
#include using namespace std; void GetNextArrary(string szPattern , int* aiNext) { aiNext[0] =-1; int iPatternLength = szPatt原创 2011-07-14 14:51:04 · 727 阅读 · 0 评论 -
阶乘末尾0的个数
//当然算法,还可以优化,就是求5因子的个数,因为2因子的个数明显多于5.void GetBytes(int num,int& byteNum2,int& byteNum5) { byteNum2 =0; byteNum5 =0; int iTem原创 2011-07-23 13:20:38 · 625 阅读 · 0 评论 -
C 汉罗塔
#include #include #include #includeusing namespace std;void Move(int arraya,int arrayb,char a,char b){ cout"}void Moved(int num,int a,i原创 2011-07-22 18:39:45 · 1064 阅读 · 0 评论 -
soj 3102 不明白
超时原创 2011-07-22 01:48:00 · 676 阅读 · 0 评论 -
string的理解
浅谈对STL string的认识大体简单的可以理解为C++ string 为c字符操作数据的封装。private: chr* m_pcdata; //存数据末尾是'\0'public: Operation //各种字符串操作 ***默认strin原创 2011-07-11 17:00:20 · 510 阅读 · 0 评论 -
大数整数相加(忽略负数)
/*Name: Copyright: Author: Date: 10/07/11 21:33Description: define the carry symbol of each byte is iCarrydefine the sum symbol of each by原创 2011-07-11 17:48:26 · 594 阅读 · 0 评论 -
UVA 401 ACM 回文数
#include#includeusing namespace std;typedef enum eJudgedState{NOTHER,BOTH,PALIND,MIRRORED};struct stReversedWord{ char cOriginalWord;原创 2011-07-12 21:15:39 · 857 阅读 · 0 评论 -
快速排序
#include using namespace std; int GetDiviedPosition(int* piScr,int iStartIndex,int iEndIndex) { int iTemp = 0; int iPos = iStar原创 2011-07-14 22:37:38 · 405 阅读 · 0 评论