![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
考研
任菜菜学编程
暂无
展开
-
数据结构顺序表的基本操作
考研数据结构代码整理,都到考研证阶段了,主要自己留着看,就不做多解释了,如果初学者,可以参考其他的详细帖子。自己敲得代码#include<stdio.h>#include <stdlib.h>#define MaxSize 100typedef int EleType;typedef struct{ EleType data[MaxSize];...原创 2019-05-22 19:42:52 · 435 阅读 · 0 评论 -
数据结构图基本操作
邻接矩阵:#include <stdio.h>#include <stdlib.h>#define maxsize 50//结点定义typedef struct{ int no; char info;}VertexType;//图定义typedef struct{ int edges[maxsize][maxsize]; ...原创 2019-09-23 08:07:47 · 1980 阅读 · 0 评论 -
数据结构查找算法
顺序查找#include <stdio.h>//顺序查找int search(int a[],int n,int k){ int i; for(i=0;i<n;i++) { if(a[i]==k) return i; } return -1;}int main(){ int ...原创 2019-09-22 09:35:42 · 775 阅读 · 0 评论 -
数据结构排序算法
交换类算法:起泡算法每次选出一个最大的数字甩到后面,再次选择次大的,...循环下去。#include <stdio.h>//起泡排序void BubbleSort(int R[],int n){ //大的数字往后冒(写小的往前也行) int i,j,temp,flag=0; //最大循环次数i,同时也用作限定每次内循环次数 for(i...原创 2019-09-20 09:25:13 · 253 阅读 · 0 评论 -
数据结构树基本操作
本章内容:树的结构定义、递归的三种遍历、非递归的三种遍历、层次遍历、求深度、求特定结点以及测试的主函数。#include <stdio.h>#include <stdlib.h>#define maxsize 50//二叉树的链式存储typedef struct BTNode{ //树结点存储的类型可以更换,常用int、double、char等 ...原创 2019-09-18 15:39:41 · 929 阅读 · 0 评论 -
数据结构队列基本操作
本章内容:顺序队、链队的结构定义、判断队空、进队、出队以及主函数测试。顺序队:#include <stdio.h>#include <stdlib.h>#define maxsize 5typedef struct{ int data[maxsize]; int front; int rear;}Queue;//初始化void...原创 2019-09-17 10:01:56 · 1577 阅读 · 1 评论 -
数据结构栈基本操作
本章内容:顺序栈、链栈的结构定义、初始化、判空、进栈、入栈、测试的主函数。顺序栈:#include <stdio.h>#include <stdlib.h>#define maxsize 100//顺序栈定义typedef struct{ int data[maxsize]; int top;}Stack;//初始化栈void in...原创 2019-09-17 08:31:58 · 278 阅读 · 0 评论 -
数据结构双链表基本操作
双链表:主要注意最后结点的操作,否则容易出现NULL->prior的情况。#include <stdio.h>#include <stdlib.h>typedef struct DLNode{ int data; struct DLNode *prior; struct DLNode *next;}DLNode,*List;...原创 2019-09-16 09:04:21 · 257 阅读 · 0 评论 -
数据结构线性表基本操作
本章内容,顺序表的结构定义、查找、插入、删除、求指定位置元素、输出以及测试的主函数;链表的结构定义、头插法创建表、尾插法创建表、查询某结点、特定位置插入结点、删除结点、两个有序表的合并以及测试的主函数。顺序表#include<stdio.h>#define Maxsize 100//定义顺序线性表typedef struct Sqlist{ int data[...原创 2019-09-12 17:11:16 · 326 阅读 · 0 评论 -
王道数据结构课后题编程(顺序表)
以下问题都简述!1.搜索顺序表,查找最小值元素,用最后的元素代替它。思想:初始为第一个元素为最小值,遍历第2-n个元素,寻找最小值,并记录位置,遍历完成后替换。(为空则退出)bool delete_min(SqList &L){ int i; int Min,pos; if(L.length==0) return false; ...原创 2019-05-22 20:11:31 · 2031 阅读 · 1 评论 -
递归算法求n个不同字符的所有全排序列(无脑简单的理解)
这是一道典型的数据结构考研题,个人感觉树上讲的很好,但是我又不太理解,去搜各种博客也都是直接抄书,现在自己理解了,就把我的想法说一下,理解这个题的前提是要理解好递归思想。首先从小的来说一个数字(1):不需要排列:1两个数字(1,2),共两种:1,2;2,1三个数字(1,2,3),共六种:1,2,3 ¥¥¥1,3,2¥¥¥2,3,1¥¥¥2,1,3¥¥¥3,1,2¥¥¥3,2,1(;...原创 2019-09-24 11:40:03 · 2550 阅读 · 1 评论