源文件注释格式定制 @Aleda 2014-09-02 14:21 字数 4277 阅读 0源文件定制Linux-C/C++我也有技术恐惧症,所以自己认识一项艺术性的技术,就要去学会它。这固然是优点,但伴随的缺点是从不能很好的坚持。希望现在在真正的工作了,可以养成学习一个东西就要坚持的好习惯,这个markdown上手可能还是有点麻烦的,不过我举得只要上手了就
解题报告 #!/bin/bash 2 3 #function: crawl the webpage, and get urls 4 #data: 2015/5/19 5 #author: Aleda 6 7 #$1 is the website 8 9 function curlLinks() 10 { 11 for ((i=0; i<63; i++
Bitmap操作 #include #include #include using namespace std;const int BYTESIZE = 8;void SetBit(char* p, int position){ for (int i = 0; i < position / BYTESIZE; i++) { p++; } *p = *
线索二叉树 #include #include #include using namespace std;struct BinThrNode{ int data;//结点的数据 BinThrNode* lChild;//左孩子 BinThrNode* rChild;//右孩子 bool lTag; //有左孩子是1 bool rTag; //有右孩子是1
并查集 #include using namespace std;void Init(){ for (int i = 0; i <= N; i++) { set[i] = i; }}int Find(int x){ return set[x] = (set[x] == x ? x : Find(set[x]));}int main()
非递归遍历便利二叉树 #include using namespace std;struct TreeNode{ TreeNode* lChild; TreeNode* rChild; int m_iData; TreeNode() { lChild = NULL; rChild = NULL; m_iData = 0;
哈希探查的三种方法 #include #include #include #include using namespace std;const int MAXSIZE = 100;int hash[MAXSIZE];int MOD = MAXSIZE - 1; //小于MAXSIZE的一个质数vector hashTable[MAXSIZE];/* 线性探查int LinearProbi
快速幂 #include #include using namespace std;long long QuickPow(int a, int n, int mod){ int ans = 1; while (n) { if (n & 1) { ans = (long long)ans * a % mod;
函数传参 #include #include #include #include using namespace std;int Max(int a, int b){ return a > b ? a : b;}int GetMax(int a[][6], int N, int M){ int iMax = 0; for (int i = 0; i < N;
双栈模拟队列 #include #include using namespace std;templateclass CQueue{public: T& push(T&); T& front(); void pop();private: stack m_stack1; stack m_stack2;};templateT& CQueue:: pu
根据前序,中序求后续 #include #include #include #include #include using namespace std;void postOrder(char *pre, char *in, int len) { if (len <= 0) { return ; } int i; for (i = 0; i < len; i++) { if (in
根据前序,中序构建出BinaryTree #include #include #include using namespace std;struct TreeNode{ int m_iValue; TreeNode* m_pLeft; TreeNode* m_pRight; TreeNode() { m_pLeft = NULL; m_pRight =
洋气的SPFA #include #include #include #include using namespace std;const int MAXN = 100 + 11;const int INF = 0x3FFFFFFF;class Edge{public: Edge(); ~Edge(); int getBegin(); void setBeg
虚函数的实现机制 #include using namespace std;class CBase1 { private: int a; int b; void sayBye() { cout << "Bye, CBase1!" << endl; } public: CBase1() { cout << "Hello CBase1!" << endl;
C++一些宏定义 #include #define PI 3.1415926 //#define #define MIN(X, Y) (X) () #define Conn(X, Y) X##Y //简单的把x和y连接起来,但不处理。即Conn(a, 2)--->a2, 编译的时候,如果没有a2就会报错。//#define TOCHAR(X) #@X 不可以这样使用#define TOSTRING(X
CreateThread()和_biginthreadex() HANDLE WINAPI CreateThread( _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ SIZE_T dwStackSize, _In_ LPTHREAD_START_ROUTINE lpStartAddress, _In_opt_ LPVOID lpParameter,
堆排序 #include #include #include #include using namespace std;void print(int *a, int n){ for (int i = 1; i <= n; i++) { printf("%d ", a[i]); } cout << endl;}void heapify(int *a, int x, int
合并排序 #include #include #include #include const int INF = 0x7fffffff;using namespace std;void merge(int *a, int l, int mid, int r) { int L[100]; int R[100]; int cnt = 0; for (int i = l; i <=