随笔分类 - 数据结构
摘要:#include<stdlib.h> #include<stdio.h> #include<string.h> #define MAX 10005 typedef struct node { char a[16]; int len; }node; node te,t[MAX]; int n=0; v
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #define OK 1 #define Error 0 typedef int Status; //栈 typedef struct StackNode { int data; struct StackNode *next;
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #define OK 1 #define Error 0 typedef int Status; //ջ typedef struct StackNode { char a; struct StackNode *next; }
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct BiTNode { char date[4]; struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; int creB(BiTree &Q) { Q=
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct BiTNode { char date[4]; struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; int creB(BiTree &Q) { Q=
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct BiTNode { char date[4]; struct BiTNode *lchild, *rchild; }BiTNode, *BiTree; int
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct BiTNode { char date[16]; struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; void
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #define MAX 100//最大容量 typedef struct node { int i; int j;//坐标 }node; //队列节点 typedef struct { node *base; int tou;
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct { int weight; int parent,lchild,rchild; }HTNode,*HuffmanTree; void Select(HuffmanTree &HT,int n,in
阅读全文
摘要:给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 num
阅读全文
摘要:二分查找法 二分查找也称折半查找(Binary Search),它是一种效率较高的查找方法。但是,折半查找要求线性表必须采用顺序存储结构,而且表中元素按关键字有序排列。 1>二分查找法的查找过程 先确定待查记录所在的范围(区间),然后逐步缩小范围知道查找到或找不到该记录 int searchN(in
阅读全文
摘要:约瑟夫问题 约瑟夫环问题是一个数学应用题:已知n个人(以编号1,2,3.....,n)围坐在一张圆桌的周围。从编号为k的人开始报数,数到m的那个人出列:他的下一个人又从1开始报数,数到m的那个人又出列,以此规律重复下去,直到圆桌的人全部出列。通常解决这类问题时我们把编号从0-n-1,最后+1即为原问
阅读全文

浙公网安备 33010602011771号