![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法基础
destiny_JL
这个作者很懒,什么都没留下…
展开
-
数据结构——栈的操作代码
#include<stdio.h>#include<stdlib.h>#define stack_size 10typedef int stackelementtype;typedef struct{stackelementtype elem[stack_size]; /*用来存放栈中元素的一维数组*/int top; /*用来存放栈顶元素的下标,top为-1表示空栈*/}SeqStack; SeqStack* InitStack原创 2020-12-09 21:23:51 · 714 阅读 · 0 评论 -
有序表合并——用链表实现
原创 2020-12-09 17:18:10 · 336 阅读 · 0 评论 -
数据结构_链表详细代码
#include<stdio.h>#include<stdlib.h>typedef int elemtype;typedef struct node { elemtype data; struct node *next;}*linklist,node;linklist initlinklist(){ linklist h=(node*)malloc(sizeof(node)); h->next=NULL; return h;}void inse原创 2020-12-06 18:53:41 · 1267 阅读 · 0 评论 -
数据结构中线性表的基本操作
线性表的定义和特点同一线性表中的元素必定具有相同的特征,数据元素间的关系是线性的。顺序表的基本操作InitList(&L)(Initialization List) 初始化线性表DestroyList(&L)ClearList(&L): 表置空ListEmpty(L): 若线性表L为空表,则返回TUREListLength(L)GetElem(L,i,&e) 用e返回线性表L中第i个数据元素的值。LocateElem(L,e,compare()); com原创 2020-12-02 22:53:33 · 1041 阅读 · 0 评论 -
数据结构_顺序表详细代码
#include <stdio.h>#include <stdlib.h>#define M 100typedef int ElemType;typedef struct{ ElemType elem[M]; /* 线性表占用的数组空间*/ int last; /*记录线性表中最后一个元素在数组elem[ ] 中的位置(下标值),空表置为-1*/}SeqList;SeqLi原创 2020-12-02 22:51:53 · 1783 阅读 · 0 评论 -
数据结构中类C语言有关操作(数组定义、传值与传址的五种情况)
线性表的抽象数据类型基本操作InitList(&L)(Initialization List) 初始化线性表DestroyList(&L)ClearList(&L): 表置空ListEmpty(L): 若线性表L为空表,则返回TUREListLength(L)GetElem(L,i,&e) 用e返回线性表L中第i个数据元素的值。LocateElem(L,e,compare()); compare()是数据元素判定函数。操作结果是返回L中第一个与e满足com原创 2020-12-01 23:30:27 · 769 阅读 · 0 评论 -
for循环中每条语句执行的次数以及时间复杂度的计算
示例代码展示1.for(i=1;i<=n;i++){ //n+1次 - for(j=1;j<=n;j++){ //n(n+1)次 - c[i][j]=0; //n*n次 - for(k=0;k<n;k++) //n*n*(n+1)次 - c[i][[j]=c[i][[j]+a[i][j]*b[k][j]; //n*n*n次 - }7.}示例代码为两个n × n矩阵相乘的算法我们把原创 2020-11-27 19:58:16 · 22720 阅读 · 3 评论