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

创建

二叉树的递归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. //利用栈,先进后出
  285. //关键点,把有子树的父节点的tag设置成R。当pop出的节点有子节点,并且此节点的tag为R的话,就说明此节点的子节点已经入栈了,所以直接打印出来。
  286. void display_node_lrc(BinTreeNode* n){
  287. if(NULL == n){
  288. printf("是空树\n");
  289. return;
  290. }
  291. nodestack stack;
  292. init(&stack);
  293. push(&stack, n);
  294. Node* tmp = NULL;
  295. while(0 != stack.size){
  296. tmp = pop(&stack);
  297. if(tmp->tag == R){
  298. printf("%c ", tmp->data->data);
  299. continue;
  300. }
  301. if(NULL != tmp->data->leftChild){
  302. //中心节点
  303. push(&stack, tmp->data);
  304. //把中心节点的属性设置成R
  305. stack.top->tag = R;
  306. if(NULL != tmp->data->rightChild){
  307. push(&stack, tmp->data->rightChild);
  308. }
  309. push(&stack, tmp->data->leftChild);
  310. }
  311. else{
  312. if(NULL == tmp->data->rightChild){
  313. printf("%c ", tmp->data->data);
  314. }
  315. else{
  316. //中心节点
  317. push(&stack, tmp->data);
  318. //把中心节点的属性设置成R
  319. stack.top->tag = R;
  320. push(&stack, tmp->data->rightChild);
  321. }
  322. }
  323. }
  324. }
  325. //非递归 先左树,再右树,再中心
  326. void display_lrc(BinTree* tr){
  327. display_node_lrc(tr->root);
  328. }

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

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

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

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

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

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

  3. 145.Binary Tree Postorder Traversal---二叉树后序非递归遍历

    题目链接 题目大意:后序遍历二叉树. 法一:普通递归,只是这里需要传入一个list来存储遍历结果.代码如下(耗时1ms): public List<Integer> postorderTr ...

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

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

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

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

  6. 非递归遍历N-ary树Java实现

    2019-03-25 14:10:51 非递归遍历二叉树的Java版本实现之前已经进行了总结,这次做的是非递归遍历多叉树的Java版本实现. 在非递归遍历二叉树的问题中我个人比较推荐的是使用双whil ...

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

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

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

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

  9. WPF树形菜单--递归与非递归遍历生成树结构的集合

    一.新建了WPF项目作为测试,使用TreeView控件进行界面展示. 第一步创建实体类TreeEntity: public class TreeEntity { private int _mid; p ...

随机推荐

  1. 【Flask-RESTPlus系列】Part2:响应编组

    0x00 内容概览 响应编组 基本使用 重命名属性 默认值 自定义字段及多值情况 Url及其他具体字段 复杂结构 列表字段 嵌套字段 api.model()工厂 clone实现复制 api.inher ...

  2. https下 http的会被阻塞 This request has been blocked; the content must be served over HTTPS.

    如何在HTTPS 网页中引入HTTP资源: Mixed Content? https://segmentfault.com/q/1010000005872734/a-1020000005874533 ...

  3. MySQL中间件之ProxySQL(13):ProxySQL集群

    返回ProxySQL系列文章:http://www.cnblogs.com/f-ck-need-u/p/7586194.html ProxySQL有原生的集群功能,但是这个原生的集群功能还正在试验阶段 ...

  4. advanced installer重新打包教程

    一.简介 本次利用Advanced Installer软件里的Repackager重封装工具进行测试制作MSI安装包,还开可以利用Advanced Installerr制作MSI安装包 原理为执行两次 ...

  5. 注册asp.net 4.0版本到IIS服务器中

    在IIS服务器的运维的过程中,有时候部署asp.net网站发现未安装.net framework对应版本信息,此时就需要重新将.net framework对应的版本注册到IIS中,此处以重新注册.ne ...

  6. 【转载】ASP.NET生成图片的缩略图

    图片处理是C#程序开发中时常会涉及到的一个业务,除了图像的上传.保存以及下载等功能外,根据上传的图片生成一个缩略图也是常见业务,在C#语言中,可以通过Image类提供的相关方法对图片进行操作,如指定宽 ...

  7. 杭电ACM2002--计算球体积

    计算球体积 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  8. .NET MVC JSON JavaScriptSerializer 字符串的长度超过 maxJsonLength 值问题的解决

    [ArgumentException: 使用 JSON JavaScriptSerializer 序列化或还原序列化期间发生错误.字符串的长度超过在 maxJsonLength 属性上设定的值. 参数 ...

  9. [android] 采用服务录制电话&服务的生命周期

    根据上一节代码里,加入一个录音功能,上传到服务器,就能实现一个录制器 当手机处于通话状态时,开启录音机 获取MediaRecorder对象,通过new出来 调用MediaRecorder对象的setA ...

  10. Hibernate入门(十)inverse

    双向关联产生多余的SQL语句 /** * 添加一个订单到id为6的客户中 */ @Test public void fun1(){ Session session = HibernateUtils.g ...