随笔分类 -  数据结构

折半查找(c语言)
摘要:#include <stdio.h> /** * * @param arr 数组必须是有序的 * @param len 数组的长度 * @param tagger 要查找的数据 * @return 要查找的数据的下标,没有就返加-1 */ int binarySearch(int arr[], in 阅读全文

posted @ 2020-08-16 18:56 哈哈哈天蝎 阅读(843) 评论(0) 推荐(0)

各种排序(c语言)
摘要:typedef int ELemType; // 冒泡排序 void bubbleSort(ELemType arr[], int len) { int i, j, temp; for (i = 1; i < len; i++) { for (j = 0; j < len - i; j++) { i 阅读全文

posted @ 2020-08-15 00:07 哈哈哈天蝎 阅读(196) 评论(0) 推荐(0)

堆排序(c语言)
摘要:#include <stdio.h> void heapify(int arr[], int root, int len) { int L = root * 2 + 1; int R = root * 2 + 2; int maxIndex = root; int temp; // 如果L还在数组当 阅读全文

posted @ 2020-08-15 00:01 哈哈哈天蝎 阅读(273) 评论(0) 推荐(0)

二杈树(c语言链表实现)
摘要:用例中的树的结构图 #include <stdio.h> #include <stdlib.h> typedef int ElemType; struct TreeNode { ElemType value; struct TreeNode *lChild, *rChild; }; typedef 阅读全文

posted @ 2020-08-03 17:00 哈哈哈天蝎 阅读(246) 评论(0) 推荐(0)

队列(c语言链表实现)
摘要:#include <stdio.h> #include <stdlib.h> struct Node { int value; struct Node* next; }; typedef struct Node Node; struct Queue { Node *front; Node *rear 阅读全文

posted @ 2020-08-02 09:49 哈哈哈天蝎 阅读(367) 评论(0) 推荐(0)

栈(c语言)链表实现
摘要:节点的结构 struct Node { int value; struct Node* next; }; typedef struct Node Node; 基本功能和操作演示 #include <stdio.h> #include <stdlib.h> struct Stack { Node *n 阅读全文

posted @ 2020-07-30 20:16 哈哈哈天蝎 阅读(454) 评论(0) 推荐(0)

链表(c语言实现)
摘要:节点的数据结构 struct Node { int value; struct Node* next; }; typedef struct Node Node; 操作和演示 #include <stdlib.h> #include <stdio.h> // 建立一个节点 Node *createNo 阅读全文

posted @ 2020-07-30 00:09 哈哈哈天蝎 阅读(233) 评论(0) 推荐(0)

导航