[Data structures]Depth first search forest
#include <stdio.h> #include <stdlib.h> #define MAX 20 #define INFINIT 65535 typedef struct _ArcCell{ int adj; // Weight or flag about connection int *info; // Other information }ArcCell; typedef char VertexType; typedef enum{ DG, DN, UDG, UDN }GraphKind; ty...标签: Data Structures data_structures
[Data structures]Graph travers (DFS and BFS)
#include <stdio.h> #include <stdlib.h> #define MAX 20 #define INFINIT 65535 typedef struct _ArcCell{ int adj; // Weight or flag about connection int *info; // Other information }ArcCell; typedef char VertexType; typedef enum{ DG, DN, UDG, UDN }GraphKind; ty...标签: Data Structures data_structures
[Data structures]Hash table
#include <stdio.h> #include <stdlib.h> #define NULLKEY -1 int hashsize[] = {10, 20, 40, 100, 1024}; typedef struct _HashTable{ int *elem; int count; // count of the elements of the table now; int sizeIndex; // hashsize[sizeIndex] is the size of the table now; }HashTabl...标签: Data Structures data_structures
[Data structures]Digital search tree - Trie tree
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define MAX_LEN 8 typedef struct _TrieTree{ int kind; // 0-leaf; 1-branch union{ struct {char keys[MAX_LEN]; char *infoptr;} leaf; struct {struct _TrieTree *ptr[27]; int num;} bra...标签: Data Structures data_structures
[Data structures]Digital search tree - Double link tree
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> typedef struct _DLTree{ char symbol; // key struct _DLTree *next; int kind; // 0-leaf; 1-branch union{ char *infoptr; //Pointer to the data struct _DLTree *first; }; }DLTree; ...标签: Data Structures data_structures
[Data structures]B-Tree
#include <stdio.h> #include <stdlib.h> #include <math.h> #define m 3 typedef struct _BTree{ int keynum; struct _BTree *parent; //Record *data[m+1]; /* Begin from 1 */ int key[m+1]; /* Begin from 1 */ struct _BTree *child[m+1]; /* Begin from 0 */ }BTree; ...标签: Data Structures data_structures
[embeded] A sample of searial port communication
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <termios.h> void main() { struct termios opt; int tty; int len; int i; unsigned...[Data structures]Balance binary search tree (AVL)
#include <stdio.h> #include <stdlib.h> typedef struct _BinaryTree{ int key; int bf; struct _BinaryTree *left; struct _BinaryTree *right; }BinaryTree; void R_Rotate(BinaryTree **T) { BinaryTree *lc; lc = (*T)->left; (*T)->left = lc->right; lc->right = ...标签: Data Structures data_structures
[Data structures]Binary search tree
#include <stdio.h> #include <stdlib.h> typedef struct _BinaryTree{ int key; struct _BinaryTree *left; struct _BinaryTree *right; }BinaryTree; int searchBST(BinaryTree *T, int key, BinaryTree *f, BinaryTree **p) { if(T == NULL){ *p = f; return 0; } if(T->key ...标签: Data Structures data_structures
[Data structures]Second optimal search tree
#include <stdio.h> #include <stdlib.h> typedef struct _BinaryTree{ int key; struct _BinaryTree *left; struct _BinaryTree *right; }BinaryTree; /* seq[] from 1 to n; sw[0] = 0 */ void secondOptimal(BinaryTree **T, int seq[], float sw[], int low, int high) { BinaryTree *p=...日历
最新微语
- 有的时候,会站在分叉路口,不知道向左还是右
2023-12-26 15:34
- 繁花乱开,鸟雀逐风。心自宁静,纷扰不闻。
2023-03-14 09:56
- 对于不可控的事,我们保持乐观,对于可控的事情,我们保持谨慎。
2023-02-09 11:03
- 小时候,
暑假意味着无忧无虑地玩很长一段时间,
节假意味着好吃好喝还有很多长期不见的小朋友来玩...
长大后,
这是女儿第一个暑假,
一个半月...
2022-07-11 08:54
- Watching the autumn leaves falling as you grow older together
2018-10-25 09:45
分类
最新评论
- Goonog
i get it now :) - 萧
@Fluzak:The web host... - Fluzak
Nice blog here! Also... - Albertarive
In my opinion you co... - ChesterHep
What does it plan? - ChesterHep
No, opposite. - mojoheadz
Everything is OK!... - Josephmaigh
I just want to say t... - ChesterHep
What good topic - AnthonyBub
Certainly, never it ...