二叉树的创建与遍历(非递归遍历左右中,破坏树结构)

创建

二叉树的递归3种遍历方式:

1,先中心,再左树,再右树

2,先左树,再中心,再右树

3,先左树,再右树,再中心

二叉树的非递归4种遍历方式:

1,先中心,再左树,再右树

2,先左树,再中心,再右树

3,先左树,再右树,再中心

4,层级遍历

二叉树的查找,求高度,求个数,求父节点,复制二叉树,释放二叉树

编译方法,用gcc编译不过去,用g++编译,命令如下:

g++ -g nodestack.c nodequeue.c bintree.c bintreemain.c

bintree.h

  1. #ifndef __BINTREE__
  2. #define __BINTREE__
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <assert.h>
  6. #define ElemType char
  7. typedef struct BinTreeNode{
  8. ElemType data;
  9. struct BinTreeNode* leftChild;
  10. struct BinTreeNode* rightChild;
  11. }BinTreeNode;
  12. typedef struct BinTree{
  13. BinTreeNode* root;
  14. ElemType ref;
  15. }BinTree;
  16. void init(BinTree* tr, ElemType val);
  17. void createBinTree(BinTree* bt);
  18. void createBinTree_str(BinTree* bt, char** str);
  19. //先中心,再左树,再右树
  20. void show_clr(BinTree* tr);
  21. //先左树,再中心,再右树
  22. void show_lcr(BinTree* tr);
  23. //先左树,再右树,再中心
  24. void show_lrc(BinTree* tr);
  25. //层级遍历
  26. void show_level(BinTree* tr);
  27. //二叉树的查找方法1
  28. int get_size1(BinTree* tr);
  29. //二叉树的查找方法2
  30. int get_size2(BinTree* tr);
  31. //求二叉树的高度
  32. int get_height(BinTree* tr);
  33. //查找二叉树
  34. BinTreeNode* search(BinTree* tr, ElemType key);
  35. //求某个节点的父节点
  36. BinTreeNode* get_parent(BinTree* tr, BinTreeNode* p);
  37. //树是否为空
  38. bool isBintreeEmpty(BinTree* tr);
  39. //复制一课二叉树
  40. void copy(BinTree* tr1, BinTree* tr2);
  41. //释放二叉树
  42. void bintree_clear(BinTree* tr);
  43. //先中心,再左树,再右树
  44. void display_clr(BinTree* tr);
  45. //先左树,再中心,再右树
  46. void display_lcr(BinTree* tr);
  47. //先左树,再右树,再中心
  48. void display_lrc(BinTree* tr);
  49. //先左树,再右树,再中心
  50. void display_lrc1(BinTree* tr);
  51. #endif

bintree.c

  1. #include "bintree.h"
  2. #include "nodequeue.h"
  3. #include "nodestack.h"
  4. void init(BinTree* tr, ElemType val){
  5. tr->root = NULL;
  6. tr->ref = val;
  7. }
  8. void createRoot(BinTree* bt, BinTreeNode** t){
  9. ElemType item;
  10. scanf("%c", &item);
  11. if(item == bt->ref){
  12. *t = NULL;
  13. }
  14. else{
  15. *t = (BinTreeNode*)malloc(sizeof(BinTreeNode));
  16. assert(*t != NULL);
  17. (*t)->data = item;
  18. createRoot(bt, &((*t)->leftChild));
  19. createRoot(bt, &((*t)->rightChild));
  20. }
  21. }
  22. void createBinTree(BinTree* bt){
  23. createRoot(bt, &(bt->root));
  24. }
  25. void createNode_str(BinTree* bt, BinTreeNode** t, char** str){
  26. if(**str == '\0'){
  27. return;
  28. }
  29. if(**str == bt->ref){
  30. *t = NULL;
  31. *str = *str + 1;
  32. }
  33. else{
  34. *t = (BinTreeNode*)malloc(sizeof(BinTreeNode));
  35. (*t)->data = **str;
  36. *str = *str + 1;
  37. createNode_str(bt, &((*t)->leftChild), str);
  38. createNode_str(bt, &((*t)->rightChild), str);
  39. }
  40. }
  41. void createBinTree_str(BinTree* bt, char** str){
  42. createNode_str(bt, &(bt->root), str);
  43. }
  44. //先中心,再左树,再右树
  45. void show_node_clr(BinTreeNode* n){
  46. if(NULL == n)return;
  47. else{
  48. printf("%c ", n->data);
  49. show_node_clr(n->leftChild);
  50. show_node_clr(n->rightChild);
  51. }
  52. }
  53. //先中心,再左树,再右树
  54. void show_clr(BinTree* tr){
  55. show_node_clr(tr->root);
  56. }
  57. //先左树,再中心,再右树
  58. void show_node_lcr(BinTreeNode* n){
  59. if(NULL == n)return;
  60. else{
  61. show_node_lcr(n->leftChild);
  62. printf("%c ", n->data);
  63. show_node_lcr(n->rightChild);
  64. }
  65. }
  66. //先左树,再中心,再右树
  67. void show_lcr(BinTree* tr){
  68. show_node_lcr(tr->root);
  69. }
  70. //先左树,再右树,再中心
  71. void show_node_lrc(BinTreeNode* n){
  72. if(NULL == n)return;
  73. else{
  74. show_node_lrc(n->leftChild);
  75. show_node_lrc(n->rightChild);
  76. printf("%c ", n->data);
  77. }
  78. }
  79. //先左树,再右树,再中心
  80. void show_lrc(BinTree* tr){
  81. show_node_lrc(tr->root);
  82. }
  83. //非递归层级遍历
  84. //利用队列,先进先出
  85. void show_node_level(BinTreeNode* n){
  86. if(NULL == n) return;
  87. NodeQueue queue;
  88. init_queue(&queue);
  89. enQueue(&queue, n);
  90. BinTreeNode* tmp;
  91. while(!isQueueEmpty(&queue)){
  92. if(getHead(&queue) == NULL)break;
  93. tmp = getHead(&queue)->data;
  94. deQueue(&queue);
  95. printf("%c ", tmp->data);
  96. if(tmp->leftChild != NULL)
  97. enQueue(&queue, tmp->leftChild);
  98. if(tmp->rightChild != NULL)
  99. enQueue(&queue, tmp->rightChild);
  100. }
  101. printf("\n");
  102. }
  103. //层级遍历
  104. void show_level(BinTree* tr){
  105. show_node_level(tr->root);
  106. }
  107. //--------------------分界线--------------------
  108. //取得树中节点个数
  109. void get_node_size1(BinTreeNode* n, int* p){
  110. if (NULL == n)return;
  111. else{
  112. *p = *p + 1;
  113. get_node_size1(n->leftChild, p);
  114. get_node_size1(n->rightChild, p);
  115. }
  116. }
  117. //取得树中节点个数
  118. int get_size1(BinTree* tr){
  119. int size = 0;
  120. get_node_size1(tr->root, &size);
  121. return size;
  122. }
  123. int get_node_size2(BinTreeNode* p){
  124. if(NULL == p) return 0;
  125. else{
  126. return get_node_size2(p->leftChild) + get_node_size2(p->rightChild) + 1;
  127. }
  128. }
  129. int get_size2(BinTree* tr){
  130. return get_node_size2(tr->root);
  131. }
  132. //分别求左右树的高度,哪个高,哪就是树的高度
  133. void get_node_height(BinTreeNode* n, int* p){
  134. if(NULL == n) return;
  135. *p = *p + 1;
  136. int t1 = 0, t2 = 0;
  137. get_node_height(n->leftChild, &t1);
  138. get_node_height(n->rightChild,&t2);
  139. if(t1 > t2)
  140. *p = *p + t1;
  141. else
  142. *p = *p + t2;
  143. }
  144. int get_height(BinTree* tr){
  145. int size = 0;
  146. if(tr->root != NULL) size++;
  147. int t1 = 0, t2 = 0;
  148. get_node_height(tr->root->leftChild, &t1);
  149. get_node_height(tr->root->rightChild, &t2);
  150. return t1 > t2 ? t1 + size : t2 + size;
  151. }
  152. //递归查找节点,如果在左节点找到了,就不需要查找右节点了
  153. BinTreeNode* search_node(BinTreeNode* n, ElemType key){
  154. if (NULL == n || n->data == key){
  155. return n;
  156. }else{
  157. BinTreeNode* tmp;
  158. tmp = search_node(n->leftChild, key);
  159. if(NULL == tmp){
  160. tmp = search_node(n->rightChild, key);
  161. }
  162. return tmp;
  163. }
  164. }
  165. BinTreeNode* search(BinTree* tr, ElemType key){
  166. BinTreeNode* n = NULL;
  167. n = search_node(tr->root, key);
  168. return n;
  169. }
  170. //递归查找父节点,如果父节点的左节点已经为目标节点,就不需要再判断这个父节点的右节点了。
  171. BinTreeNode* get_node_parent(BinTreeNode* n, BinTreeNode* target){
  172. if(NULL == n || NULL == target) return NULL;
  173. if(n->leftChild == target || n->rightChild == target){
  174. return n;
  175. }
  176. else{
  177. BinTreeNode* tmp = NULL;
  178. tmp = get_node_parent(n->leftChild, target);
  179. if(NULL == tmp){
  180. tmp = get_node_parent(n->rightChild, target);
  181. }
  182. return tmp;
  183. }
  184. }
  185. BinTreeNode* get_parent(BinTree* tr, BinTreeNode* target){
  186. get_node_parent(tr->root, target);
  187. }
  188. bool isBintreeEmpty(BinTree* tr){
  189. return NULL == tr->root;
  190. }
  191. void copy_node(BinTreeNode** n1, BinTreeNode* n2){
  192. if(NULL == n2){
  193. *n1 = NULL;
  194. return;
  195. }else{
  196. BinTreeNode* p = (BinTreeNode*)malloc(sizeof(BinTreeNode*));
  197. p->data = n2->data;
  198. *n1 = p;
  199. copy_node(&((*n1)->leftChild), n2->leftChild);
  200. copy_node(&((*n1)->rightChild), n2->rightChild);
  201. }
  202. }
  203. void copy(BinTree* tr1, BinTree* tr2){
  204. copy_node(&(tr1->root), tr2->root);
  205. }
  206. void bintree_node_clear(BinTreeNode** n){
  207. if(NULL == *n)return;
  208. bintree_node_clear(&((*n)->leftChild));
  209. bintree_node_clear(&((*n)->rightChild));
  210. free(*n);
  211. *n = NULL;
  212. }
  213. void bintree_clear(BinTree* tr){
  214. bintree_node_clear(&(tr->root));
  215. // init(tr, '#');
  216. }
  217. //非递归 先中心,再左树,再右树
  218. //利用栈,先进后出
  219. void display_node_clr(BinTreeNode* n){
  220. if(NULL == n){
  221. printf("是空树\n");
  222. return;
  223. }
  224. nodestack stack;
  225. init(&stack);
  226. push(&stack, n);
  227. Node* tmp = NULL;
  228. while(0 != stack.size){
  229. tmp = pop(&stack);
  230. if(NULL == tmp) continue;
  231. printf("%c ", tmp->data->data);
  232. if(tmp->data->rightChild != NULL)
  233. push(&stack, tmp->data->rightChild);
  234. if(tmp->data->leftChild != NULL)
  235. push(&stack, tmp->data->leftChild);
  236. }
  237. }
  238. //非递归 先中心,再左树,再右树
  239. void display_clr(BinTree* tr){
  240. display_node_clr(tr->root);
  241. }
  242. //非递归 先左树,再中心,再右树
  243. //利用栈,先进后出
  244. void display_node_lcr(BinTreeNode* n){
  245. if(NULL == n){
  246. printf("是空树\n");
  247. return;
  248. }
  249. nodestack stack;
  250. init(&stack);
  251. push(&stack, n);
  252. Node* tmp = NULL;
  253. while(0 != stack.size){
  254. tmp = pop(&stack);
  255. if(NULL != tmp->data->leftChild){
  256. if(NULL != tmp->data->rightChild){
  257. push(&stack, tmp->data->rightChild);
  258. }
  259. //中心节点
  260. push(&stack, tmp->data);
  261. push(&stack, tmp->data->leftChild);
  262. }
  263. else{
  264. //再把中心节点pop出来
  265. if(NULL == tmp->data->rightChild){
  266. printf("%c ", tmp->data->data);
  267. //pop出来的tmp为中心节点
  268. tmp = pop(&stack);
  269. if(NULL == tmp)continue;
  270. printf("%c ", tmp->data->data);
  271. }
  272. else{
  273. printf("%c ", tmp->data->data);
  274. push(&stack, tmp->data->rightChild);
  275. }
  276. }
  277. }
  278. }
  279. //非递归 先左树,再中心,再右树
  280. void display_lcr(BinTree* tr){
  281. display_node_lcr(tr->root);
  282. }
  283. //非递归 先左树,再右树,再中心(虽然实现了遍历,但是破坏了树的结构)
  284. void display_node_lrc(BinTreeNode* n){
  285. if(NULL == n){
  286. printf("是空树\n");
  287. return;
  288. }
  289. nodestack stack;
  290. init(&stack);
  291. push(&stack, n);
  292. Node* tmp = NULL;
  293. while(0 != stack.size){
  294. tmp = pop(&stack);
  295. if(NULL != tmp->data->leftChild){
  296. //中心节点
  297. push(&stack, tmp->data);
  298. if(NULL != tmp->data->rightChild){
  299. push(&stack, tmp->data->rightChild);
  300. }
  301. push(&stack, tmp->data->leftChild);
  302. //把中心节点的左右节点的指针设置成NULL
  303. tmp->data->rightChild = tmp->data->leftChild = NULL;
  304. }
  305. else{
  306. if(NULL == tmp->data->rightChild){
  307. printf("%c ", tmp->data->data);
  308. }
  309. else{
  310. //中心节点
  311. push(&stack, tmp->data);
  312. push(&stack, tmp->data->rightChild);
  313. //把中心节点的左右节点的指针设置成NULL
  314. tmp->data->rightChild = tmp->data->leftChild = NULL;
  315. }
  316. }
  317. }
  318. }
  319. //非递归 先左树,再右树,再中心(虽然实现了遍历,但是破坏了树的结构)
  320. void display_lrc(BinTree* tr){
  321. display_node_lrc(tr->root);
  322. }

bintreemain.c

  1. #include "bintree.h"
  2. int main(){
  3. BinTree tr;
  4. init(&tr, '#');
  5. //ABC##DE##F##G##H##
  6. //createBinTree(&tr);
  7. char* a = "ABC##DE##F##G#H##";
  8. //char* a = "AB##C##";
  9. BinTree tr1;
  10. init(&tr1, '#');
  11. createBinTree_str(&tr1, &a);
  12. show_clr(&tr1);
  13. printf("\n");
  14. show_lcr(&tr1);
  15. printf("\n");
  16. show_lrc(&tr1);
  17. printf("\n");
  18. show_level(&tr1);
  19. //非递归遍历,中 左 右
  20. display_clr(&tr1);
  21. printf("\n");
  22. //非递归遍历,左 中 右
  23. display_lcr(&tr1);
  24. printf("\n");
  25. //非递归遍历,左 右 中
  26. display_lrc(&tr1);
  27. printf("\n");
  28. return 0;
  29. }

nodequeue.h

  1. #ifndef __NODEQUEUE__
  2. #define __NODEQUEUE__
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <assert.h>
  6. #include <memory.h>
  7. #include <stdbool.h>
  8. struct BinTreeNode;
  9. #define ElemType1 BinTreeNode*
  10. typedef struct Node{
  11. ElemType1 data;
  12. struct Node* next;
  13. }Node;
  14. typedef struct NodeQueue{
  15. Node* front;
  16. Node* tail;
  17. size_t size;
  18. }NodeQueue;
  19. void init_queue(NodeQueue*);
  20. void enQueue(NodeQueue*, ElemType1);
  21. void deQueue(NodeQueue*);
  22. void show_list(NodeQueue*);
  23. int length(NodeQueue*);
  24. void clear(NodeQueue*);
  25. void destroy(NodeQueue*);
  26. Node* getHead(NodeQueue*);
  27. bool isQueueEmpty(NodeQueue*);
  28. #endif

nodequeue.c

  1. #include "nodequeue.h"
  2. void init_queue(NodeQueue* queue){
  3. queue->front = queue->tail = (Node*)malloc(sizeof(Node));
  4. queue->tail->next = NULL;
  5. queue->size = 0;
  6. }
  7. //入队(尾插)
  8. void enQueue(NodeQueue* queue, ElemType1 val){
  9. Node* p = (Node*)malloc(sizeof(Node));
  10. p->data = val;
  11. if(queue->front->next == NULL){
  12. queue->front->next = p;
  13. }
  14. else{
  15. queue->tail->next = p;
  16. }
  17. queue->tail = p;
  18. p->next = NULL;
  19. queue->size++;
  20. }
  21. //出队(头删)
  22. void deQueue(NodeQueue* queue){
  23. if(queue->size == 0)return;
  24. Node* tmp = queue->front->next;
  25. queue->front->next = queue->front->next->next;
  26. free(tmp);
  27. queue->size--;
  28. }
  29. nt length(NodeQueue* queue){
  30. return queue->size;
  31. }
  32. void show_list(NodeQueue* queue){
  33. Node* p = queue->front;
  34. while(p->next != NULL){
  35. printf("%d\n", p->next->data);
  36. p = p->next;
  37. }
  38. }
  39. void clear(NodeQueue* queue){
  40. if(queue->size == 0)return;
  41. Node* p = queue->front;
  42. Node* tmp;
  43. while(p->next != NULL){
  44. tmp = p->next;
  45. p = p->next;
  46. free(tmp);
  47. }
  48. queue->tail = queue->front;
  49. queue->tail->next = NULL;
  50. queue->size = 0;
  51. }
  52. void destroy(NodeQueue* queue){
  53. clear(queue);
  54. free(queue->front);
  55. }
  56. Node* getHead(NodeQueue* queue){
  57. return queue->front->next;
  58. }
  59. bool isQueueEmpty(NodeQueue* queue){
  60. return queue->front == queue->tail;
  61. }

nodestack.h

  1. #ifndef __NODESTACK__
  2. #define __NODESTACK__
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <assert.h>
  6. #include <memory.h>
  7. #include <stdbool.h>
  8. struct BinTreeNode;
  9. typedef BinTreeNode* ElemType2;
  10. typedef struct Node{
  11. ElemType2 data;
  12. struct Node *next;
  13. }Node;
  14. typedef struct nodestack{
  15. int size;
  16. Node *base;
  17. Node *top;
  18. }nodestack;
  19. void init(nodestack*);
  20. void push(nodestack*, ElemType2);
  21. void show_list(nodestack*);
  22. Node* pop(nodestack*);
  23. int length(nodestack*);
  24. void clear(nodestack*);
  25. void destroy(nodestack*);
  26. #endif

nodestack.c

  1. #include "nodestack.h"
  2. Node* createNode(ElemType2 val){
  3. Node* n = (Node*)malloc(sizeof(Node));
  4. n->data = val;
  5. n->next = NULL;
  6. return n;
  7. }
  8. void init(nodestack* stack){
  9. stack->size = 0;
  10. stack->top = NULL;
  11. stack->base = NULL;
  12. }
  13. void push(nodestack* stack, ElemType2 x){
  14. Node* n = createNode(x);
  15. //当栈为空的时候
  16. if(stack->base == NULL){
  17. stack->top = stack->base = n;
  18. n->next = NULL;
  19. stack->size++;
  20. return;
  21. }
  22. n->next = stack->top;
  23. stack->top = n;
  24. stack->size++;
  25. }
  26. void show_list(nodestack* stack){
  27. Node* top = stack->top;
  28. while(top != NULL){
  29. printf("%d\n", top->data);
  30. top = top->next;
  31. }
  32. }
  33. Node* pop(nodestack* stack){
  34. if(stack->size == 0)return NULL;
  35. Node* n = stack->top;
  36. stack->top = stack->top->next;
  37. stack->size--;
  38. return n;
  39. }
  40. int length(nodestack* stack){
  41. return stack->size;
  42. }
  43. void clear(nodestack* stack){
  44. Node* top = stack->top;
  45. Node* tmp;
  46. while(top != NULL){
  47. tmp = top;
  48. top = top->next;
  49. free(tmp);
  50. }
  51. stack->top = stack->base = NULL;
  52. stack->size = 0;
  53. }
  54. void destroy(nodestack* stack){
  55. clear(stack);
  56. }

c/c++二叉树的创建与遍历(非递归遍历左右中,破坏树结构)的更多相关文章

  1. Java实现二叉树的创建、递归/非递归遍历

    近期复习数据结构中的二叉树的相关问题,在这里整理一下 这里包含: 1.二叉树的先序创建 2.二叉树的递归先序遍历 3.二叉树的非递归先序遍历 4.二叉树的递归中序遍历 5.二叉树的非递归中序遍历 6. ...

  2. 数据结构二叉树的递归与非递归遍历之java,javascript,php实现可编译(1)java

    前一段时间,学习数据结构的各种算法,概念不难理解,只是被C++的指针给弄的犯糊涂,于是用java,web,javascript,分别去实现数据结构的各种算法. 二叉树的遍历,本分享只是以二叉树中的先序 ...

  3. C++编程练习(17)----“二叉树非递归遍历的实现“

    二叉树的非递归遍历 最近看书上说道要掌握二叉树遍历的6种编写方式,之前只用递归方式编写过,这次就用非递归方式编写试一试. C++编程练习(8)----“二叉树的建立以及二叉树的三种遍历方式“(前序遍历 ...

  4. c/c++叉树的创建与遍历(非递归遍历左右中,不破坏树结构)

    二叉树的创建与遍历(非递归遍历左右中,不破坏树结构) 创建 二叉树的递归3种遍历方式: 1,先中心,再左树,再右树 2,先左树,再中心,再右树 3,先左树,再右树,再中心 二叉树的非递归4种遍历方式: ...

  5. ZT 二叉树的非递归遍历

    ZT 二叉树的非递归遍历 二叉树的非递归遍历 二叉树是一种非常重要的数据结构,很多其它数据结构都是基于二叉树的基础演变而来的.对于二叉树,有前序.中序以及后序三种遍历方法.因为树的定义本身就 是递归定 ...

  6. c语言描述的二叉树的基本操作(层序遍历,递归,非递归遍历)

    #include<stdio.h> #include<stdlib.h> #define OK 1 #define ERROR 0 #define TRUE 1 #define ...

  7. C++学习---二叉树的输入及非递归遍历

    二叉树的二叉链表存储表示如下 //二叉树的二叉链表存储表示 typedef struct BiTNode { char data;//结点数据域 struct BiTNode* lchild, * r ...

  8. 二叉树3种递归和非递归遍历(Java)

    import java.util.Stack; //二叉树3种递归和非递归遍历(Java) public class Traverse { /******************一二进制树的定义*** ...

  9. JAVA递归、非递归遍历二叉树(转)

    原文链接: JAVA递归.非递归遍历二叉树 import java.util.Stack; import java.util.HashMap; public class BinTree { priva ...

随机推荐

  1. 【原创】《windows驱动开发技术详解》第4章实验总结二

    1 实验要求(WDM驱动)     2 编写过程   2.1 确立整体架构   2.1.1 入口函数——DriverEntry   (1)作用 设置pDriverObject结构体,注册AddDevi ...

  2. 一个注意事项:内部类引用的外部变量必须是final的

    之前写过一个项目,好久没更新了,最近翻起以前的代码,发现在这里报了一个错.(现在转到Intellij了,从前在Eclipse luna中是可以编译通过的,Eclipse mars也会报错,JDK版本都 ...

  3. 分享一个用QT实现的Mjpeg-streamer客户端(简易版)

    mainWindow代码如下(由于篇幅问题,子窗口代码不贴出了,有需要源码的可以留下邮箱): /* * Author : 博客园 Lance# */ #include "mainwindow ...

  4. 隐马尔可夫模型(HMM)及Viterbi算法

    HMM简介   对于算法爱好者来说,隐马尔可夫模型的大名那是如雷贯耳.那么,这个模型到底长什么样?具体的原理又是什么呢?有什么具体的应用场景呢?本文将会解答这些疑惑.   本文将通过具体形象的例子来引 ...

  5. ResourceOwnerPassword模式使用数据库.

    有时候, ResourceOwnerPassword模式有用的, 可以用来代替我们原来管理程序的开发方式. 因为管理程序本身拥有用户数据的权限嘛, 并不是第三方应用, 无需要授权 集成很简单. 1. ...

  6. JQuery官方学习资料(译):$( document ).ready()

         一个页面直到document是”ready“才能被安全的操作,Jquery为你检查这种状态.代码包含在$( document ).ready()的内部将会仅仅运行一次在页面Document ...

  7. [angularjs] angularjs系列笔记(三)模型

    ng-model指令 ng-model可以将输入域的值与AngularJs的变量绑定 双向绑定 当修改输入域的值时候,AngularJs属性的值也将修改 <div ng-app="Ho ...

  8. 为什么redis是单线程的?速度还这么快

    为什么说Redis是单线程的? 为什么redis是单线程的?速度还这么快

  9. Docker 系列五(Docker Compose 项目).

    一.概念 Docker Compose 是官方编排项目之一,负责快速的部署分布式应用.它允许用户通过一个单独的 docker-compose.yml 模板文件(YAML格式)来定义一种相关联的应用容器 ...

  10. C#设计模式之六适配器模式(Adapter Pattern)【结构型】

    一.引言 从今天开始我们开始讲[结构型]设计模式,[结构型]设计模式有如下几种:适配器模式.桥接模式.装饰模式.组合模式.外观模式.享元模式.代理模式.[创建型]的设计模式解决的是对象创建的问题,那[ ...