Time of Update: 2018-12-05
轉載於:http://blog.csdn.net/tidelu77/article/details/3970075由遍曆序列得到二叉樹由前序走訪序列和中序遍曆序列得到二叉樹:比如二叉樹有七個節點(包括根)1建立7*8的表格,將中序遍曆序列寫在最上一行。2然後前序走訪序列的順序將該節點寫在2-8行(節點與中序序列在同一列)。3然後從上到下串連,將某節點與該節點以下最高的左節點和最高右節點串連。即得到二叉樹。例:前序走訪序列:ABDECFG中序遍曆序列:DBEAFCGDBEAFCG A B
Time of Update: 2018-12-05
void BT_PostOrderNoRec(pTreeT root);void BT_PostOrderNoRec(pTreeT root){ stack<treeT *> s; pTreeT pre = NULL; pTreeT top = NULL; while ((NULL != root) || !s.empty()) { if (NULL != root) { s.push(root);
Time of Update: 2018-12-05
(1): sizeof 操作符的結果是size_t 它在標頭檔中的typedef為unsigned int類型(2):sizeof 是操作符。(3)sizeof 可以用類型作參數。(4)數組做sizeof的參數不退化,傳給strlen就退化為指標。(5):大部分的編譯器在編譯時間就把sizeof計算過了,是類型或者變數的長度。(6):當用一個結構體類型或變數時,sizeof返回是實際大小。當使用一靜態空間數組,sizeof返回全部的數組的尺寸,sizeof
Time of Update: 2018-12-05
大家都知道new和delete,new[]和delete[]要配對使用,但並不是所有人都知道delete和delete[]究竟有什麼區別。有人會說delete不就是刪除對象,delete不就是刪除數組的嘛。這樣的說法應該只能說對了一半。的確,delete[]是用來釋放數組,那麼如果我用delete釋放數組又會怎樣呢?這還分兩種情況來對待: 1.delete基礎資料型別 (Elementary Data Type)數組
Time of Update: 2018-12-05
#include <cstdio>#include <cstring>void rotate(char *start, char *end){ while(start != NULL && end !=NULL && start<end) { char temp=*start; *start=*end; *end=temp; start++; end--
Time of Update: 2018-12-05
#include<iostream>#include<memory.h>#include<assert.h>using namespace std;class A{ char k[3];public: A() { k[0]='1'; k[1]='2'; k[2]='3'; } virtual void aa() { cout<<"this is A->
Time of Update: 2018-12-05
left join(左聯結) 返回包括左表中的所有記錄和右表中連接欄位相等的記錄 right join(右聯結) 返回包括右表中的所有記錄和左表中連接欄位相等的記錄inner join(等值串連) 只返回兩個表中連接欄位相等的行給個通俗的解釋吧. 例表a aid adate 1 a1 2 a2 3 a3 表b bid bdate 1 b1 2 b2 4 b4 兩個表a,b相串連,要取出id相同的欄位 select * from a inner join b on a.aid =
Time of Update: 2018-12-05
轉自:http://blog.csdn.net/v_july_v/article/details/6347454 #include <iostream> #include <string> using namespace std; bool Is_Match(const char *strOne,const char *strTwo) { int lenOfOne = strlen(strOne); int lenOfTwo =
Time of Update: 2018-12-05
#include<stdio.h>#include<string.h>char * strstr_1(char *s1,char *s2);char *strstr_2(char *s1,char *s2);char *strstr_3(char *s1, char *s2);int main(){ char *p; p=strstr_1("helloworld","wor"); printf("%s\n",p);
Time of Update: 2018-12-05
#include<stdio.h> #define MAX 4 int stack[MAX],p=-1; struct { int num; int sign; }train[MAX]; void sub() { int inc; if(p==MAX-1) { for(inc=0;inc<=p;inc++) printf("%3d",stack[inc]); printf("\n"); } else
Time of Update: 2018-12-05
轉自:http://patmusing.blog.163.com/blog/static/1358349602009113061024796/#include <iostream>using namespace std;class Point{public: int _x; int _y; public: Point(); Point(int, int);}; Point::Point(){ _x = 0
Time of Update: 2018-12-05
/*****一本書的頁碼從自然數1 開始順序編碼直到自然數n。書的頁碼按照通常的習慣編排,每個頁碼都不含多餘的前置數字0。例如,第6 頁用數字6 表示,而不是06 或006 等。數字計數問題要求對給定書的總頁碼n,計算出書的全部頁碼中分別用到多少次數字0,1, 2,…,9。*****/#include <iostream>#include<stdio.h>using namespace std;void prin0( void );void prin1( void
Time of Update: 2018-12-05
#include<stdio.h> void shift(int a[] , int i , int m){int k , t; t = a[i]; k = 2 * i + 1; while (k < m) { if ((k < m - 1) && (a[k] < a[k+1])) k ++; if (t < a[k]) {a[i] = a[k]; i = k; k = 2 * i + 1;}
Time of Update: 2018-12-05
轉自: http://blog.csdn.net/prsniper/article/details/6762145 TCP IP 資料包 結構 詳解 網路
Time of Update: 2018-12-05
// SDBM Hashunsigned int SDBMHash(char *str){ unsigned int hash = 0; while (*str) { // equivalent to: hash = 65599*hash + (*str++); hash = (*str++) + (hash << 6) + (hash << 16) - hash; } return (hash & 0
Time of Update: 2018-12-05
ubuntu下的memcached和memcache安裝因為PHP5是用apt-get安裝的,所以在安裝memcache的時候也是用apt-get install
Time of Update: 2018-12-05
本文章參照自以下連結:http://apps.hi.baidu.com/share/detail/31108816http://www.linuxidc.com/Linux/2011-06/37588.htmCygwin 是 Windows 上類似於 Linux 的環境。它包括一個提供 UNIX 功能性基本子集的 DLL 以及在這之上的一組工具。你可以只選擇一部分工具來進行安裝。在本文的中,我們將選擇GCC。安裝好 Cygwin
Time of Update: 2018-12-05
int fun(char [ ] );char a[ ]="123";fun(a);得到123#include <iostream>#include <string>#include <cstdlib>using namespace std;int str_2_int(string str){ if (str.size() == 0) exit(0); int pos = 0; int sym = 1; // 處理符號
Time of Update: 2018-12-05
//判斷n是否為2的冪#include<stdio.h>int foo( int i );int foo_(int i);int foo_1(int );int main(){ int bool1=foo(1); bool1=foo_(1024); bool1=foo_1(1024); printf("%d",bool1); return 0;}int foo (int n){ int a=n; if(n<=0) return -1;
Time of Update: 2018-12-05
# include<stdio.h> # include<string.h> const int N = 26; int bit_map[N]; void findNoRepeat(char *src) { int pos; char *str = src; int i ,len = strlen(src); //統計 for(i = 0 ; i < len ;i ++)