数据结构
CodingBugs
Nothing is impossible.
展开
-
并查集
#include #include #define maxsize 100//上一级节点/集合中元素的个数int father[maxsize],rank[maxsize];//初始化void init(int _size){ for(int i=0;i<_size;i++) { father[i]=i; rank[i]=1;原创 2016-09-12 20:00:23 · 156 阅读 · 0 评论 -
串(链串)
#include<stdio.h>#include<stdlib.h>#define NodeSize 100//链串结构体typedef struct node{ char str[NodeSize]; struct node *next;}LinkString;LinkString *InitString(LinkString *S){ S=(LinkStrin原创 2016-04-19 19:23:38 · 553 阅读 · 0 评论 -
串(顺序串)
#include<stdio.h>#include<stdlib.h>#include<string.h>#define MAXSIZE 100//串的结构体typedef struct{ char str[MAXSIZE]; int len;}SeqString;//初始化串SeqString *InitString(SeqString *S){ S=(Seq原创 2016-04-19 18:33:44 · 568 阅读 · 0 评论 -
线性表(双向链表)
#include<stdio.h>#include<stdlib.h>typedef struct node{ int data; struct node *prior,*next;}LinkDoubleList;//初始化双向链表LinkDoubleList *InitList(LinkDoubleList *L){ L=(LinkDoubleList *)mal原创 2016-03-21 16:08:11 · 260 阅读 · 0 评论 -
线性表(链表)
#include<stdio.h>#include<stdlib.h>typedef int elemtype; /*定义新类型,类型名为elemtype*////定义结构体typedef struct node{ elemtype data;原创 2016-03-17 12:36:11 · 197 阅读 · 0 评论 -
线性表(顺序表)
#include<stdio.h>#include<stdlib.h>#define MAXSIZE 100///定义结构体typedef int elemtype;typedef struct{ elemtype data[MAXSIZE]; int length;}SqList;///初始化顺序表SqList *InitList(SqList *L){ L=原创 2016-03-08 20:41:23 · 189 阅读 · 0 评论 -
队列(顺序存储)
#include<stdio.h>#include<stdlib.h>#define MAXSIZE 100//定义结构体typedef struct{ int data[MAXSIZE]; int len; int front; int rear;}SeqQueue;//初始化队列SeqQueue *InitQueue(SeqQueue *Q){原创 2016-03-18 17:30:31 · 218 阅读 · 0 评论 -
队列(链式存储)
#include<stdio.h>#include<stdlib.h>typedef struct Node{ int data; struct Node *next;}QueueNode;typedef struct{ QueueNode *front,*rear;}LinkQueue;//初始化队列LinkQueue *InitQueue(LinkQueue原创 2016-03-18 19:22:56 · 261 阅读 · 0 评论 -
栈(链式存储)
#include <stdio.h>#include <stdlib.h>//定义结构体typedef struct stacknode{ int data; struct stacknode *next;}StackNode;typedef struct{ StackNode *top;}LinkStack;//初始化链栈LinkStack *InitStac原创 2016-03-17 18:40:16 · 210 阅读 · 0 评论 -
栈(顺序存储)
#include<stdio.h>#include<stdlib.h>#define MAXSIZE 100//定义结构体typedef struct{ int data[MAXSIZE]; int top;}SeqStack;//初始化栈SeqStack *InitStack(SeqStack *S){ S=(SeqStack *)malloc(sizeof(原创 2016-03-17 17:11:17 · 226 阅读 · 0 评论 -
素数判断的几种方法代码实现及其复杂度分析
素数判断的几种方法代码实现及其复杂度分析 <div class="article_manage clearfix"> <div class="article_l"> <span class="link_categories"> 标签: <a href="http://www.csd转载 2016-11-05 20:05:43 · 13574 阅读 · 3 评论