原创 二叉樹遍歷高級版

前序遍歷: (1)遞歸思路:先樹根,然後左子樹,最後右子樹。 void preorderTraversal(TreeNode* current, vector<int> &temp_result) { if (current =

原创 linux下sublime text 3無法輸入中文

更新並將系統升級到最新版本:sudo apt-get update 在本地項目中克隆此目錄:git clone https://github.com/lyfeyaj/sublime-text-imfix.git 將你的當前目錄更改爲sub

原创 二分查找升序數組

面試美團的時候遇到二分法查找問題,在這裏記錄一下: 主要是注意點如下: (1)使用[left,right]雙閉合區間來查找,因此while必須是<=,因爲只有如此才能在循環結束的時候是left = right + 1,這樣保證所有的數據都

原创 二叉樹層次遍歷(單層輸出)

每一層都是從左到右,但是每一層輸出結束要換行(使用隊列) #include "stdio.h" #include "stdlib.h" #define MaxSize 50 /*************定義數據結構***********

原创 二級指針作爲函數輸入的三種實現方式:

#include "stdio.h" #include "stdlib.h" #include "string.h" //打印字符串內容 int PrintStr13(char ** Array, int n) {//第一種和第三種方式

原创 堆棧實現

#include "stdio.h" #include "stdlib.h" typedef struct SNode { //定義數據結構 int *data; int top; int Ma

原创 visual studio動態庫調用

工程開發中調用動態庫函數步驟: (1)將.lib,.dll,.h文件拷貝到工程文件夾下面:(64位系統需要在Debug下面也拷貝一份,再不行需要在系統system32下拷貝一份)               (2)在源文件右鍵,添加現有項

原创 工程中函數庫建立和調用

1. DLL庫建立,新建項目,在win32控制檯選擇DLL,如下圖,完成設置 2. 新建.C文件,添加頭文件和函數名(打樁)(注:#pragma warning(disable:4996 是爲了屏蔽一些函數檢查警告) 3. 在DLL工

原创 排序算法大集合

/* Note:Your choice is C IDE */ #include "stdio.h" #include "stdlib.h" /********************插入排序********************/ v

原创 最大堆實現

#include "stdio.h" #include "stdlib.h" typedef struct Heap { //定義堆結構 int *data; int Size; int Capac

原创 字符串操作

求字符串長度: #include "stdio.h" #include "stdlib.h" #include "string.h" int mystrlen(char *fstr) { int num = 0; for(;*fs

原创 二叉樹遍歷

前序遍歷,中序遍歷,後序遍歷的遞歸和非遞歸實現(堆棧): #include "stdio.h" #include "stdlib.h" /*************定義數據結構************/ typedef struct T