
数据结构
粥ou
这个作者很懒,什么都没留下…
展开
-
数据结构———顺序表的查找、删除、和插入
查找: 假设有7个元素1,定义顺序表的结构体2。与顺序表的元素一一比较、若一致,则返回位置,不一致,返回0.# define maxsize 100typedef struct{ int data[maxsize]; int length;}Sqlist;int find(Sqlist L;int e){ int i; f...原创 2019-05-10 20:08:41 · 1824 阅读 · 0 评论 -
天勤考研数据结构———单链表操作
定义单链表typedef struct LNode{ int data; struct LNode *next;}LNode;A\B皆为有序链表,合并排序到C中 头插法void merge(LNode *A,LNode *B,LNode *&C){ LNode *p=A->next; LNode *q=B->next; ...原创 2019-05-11 14:29:41 · 1084 阅读 · 0 评论 -
天勤考研数据结构———双链表操作
定义双链表的结构体类型typedef struct DLNode{ int data; struct DLNode *next; struct DLNode *prior;}DLNode;采用尾插法创建双链表:int finddelmerge(DLNode *&A,int a[],int n){ DLNode *p,*s; i...原创 2019-05-11 16:19:36 · 402 阅读 · 0 评论 -
天勤考研数据结构———顺序栈、链栈操作
typedef struct{ //定义顺序栈 int data[maxsize]; int top;//定义栈顶指针}SqStack;void init(SqStack &st)//初始化顺序栈{ st.top=-1;}int isEmpty(SqStack st)//判断顺序栈是否为空{ if(st.top=...原创 2019-05-12 10:04:47 · 638 阅读 · 0 评论 -
天勤考研数据结构———顺序队、链队操作
定义顺序队typedef struct{ int data[maxsize]; int front; int rear;}SqQueue;//定义顺序队操作void initQueue(SqQueue &qu)//初始化队列{ qu.front=qu.rear=0;}int isQueueEmpty(SqQueue qu)//判断是...原创 2019-05-12 16:18:47 · 452 阅读 · 1 评论 -
天勤数据结构--直接插入排序和希尔排序
#include<stdio.h>void InsertSort(int *arr,int len){ int i; for(i = 1;i < len;i++) { int tmp = arr[i]; int j; for(j = i-1;j >= 0;j--) { if(arr[j] > tmp) { ...原创 2019-06-22 21:26:48 · 331 阅读 · 0 评论