自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 Python

2022-07-05 12:05:17 125

原创 Anaconda

anaconda

2022-06-28 12:59:05 272

原创 DFS 邻接矩阵

#include<stdio.h>#include<malloc.h>#define MAX_VERTEX_NUM 5typedef int VertexType;typedef struct MGraph{ VertexType vexList[MAX_VERTEX_NUM]; VertexType arcMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; int vexNum,arcNum;}MGraph;int .

2021-09-21 21:53:39 209 1

原创 图 练习题

1.#include<stdio.h>#include<malloc.h>#define MAX_VERTEX_NUM 100typedef int VertexType;//表结点typedef struct ArcNode{ int adjVex;//邻接域 struct ArcNode *nextArc;}ArcNode;//头结点typedef struct VNode{ VertexType data; ArcNode

2021-09-12 10:17:18 125

原创 线索二叉树

1.先序线索二叉树的创建及遍历#include<stdio.h>#include<malloc.h>#include<iostream>using namespace std;typedef struct BiThrNode{ char data; struct BiThrNode *lchild,*rchild; int lTag,rTag;}BiThrNode,*BiThrTree;//下面这个函数用于先生成一个不带线索的二叉

2021-08-31 12:11:26 93

原创 二叉排序树

1.//构造一颗二叉排序树#include<stdio.h>#include<malloc.h>typedef struct BSTNode{ int data; struct BSTNode *lchild; struct BSTNode *rchild;}BSTNode,*BSTree;void insertNode(BSTree &T,int data){ if(T==NULL){ BSTNode *tem

2021-08-27 19:08:31 433

原创 二叉树习题

1.//给定先序序列和中序序列,创建二叉树BiTNode *createBiTree(char preOrderArr[],int preFirstIndex,int preLastIndex,char inOrderArr[],int inFirstIndex,int inLastIndex){ if(preFirstIndex>preLastIndex){ return NULL; } BiTNode *pNode=(BiTNode *)malloc

2021-08-20 17:58:22 115

原创 循环单链表

21.头插法、尾插法//头插法建立循环单链表void createLinkList(LinkList &L,int arr[],int n){ L=(LinkNode *)malloc(sizeof(LinkNode)); L->next=L; int i=0; while(i<n){ LinkNode *pNode=(LinkNode *)malloc(sizeof(LinkNode)); pNode->da

2021-08-17 17:19:45 246

原创 单链表(二)

13.//La和Lb按值非递减,归并La和Lb,得到新的单链表Lc。//使得Lc也按值非递减且不含重复元素,并占用原来的空间。/*用两个指针分别指向La和Lb的第一个数据结点。每次取较小的结点“尾插”到Lc中。如果带插入结点与尾结点相同,则释放该结点,反之则追加到尾部。重复上述步骤,直到其中一个链的结点被搜索完。随后再将剩余结点直接追加到Lc尾部*/void insertNode(LinkNode *&pTail,LinkNode *node){//在Lc尾部插入新结点

2021-08-14 18:11:57 352

原创 C语言习题(六)

26、//有一分数序列:2/1,3/2,5/3,8/5,8/13...求前20项之和#include<stdio.h>double getSum(int n){ int fenzi=2; int fenmu=1; double sum=0; for(int i=1;i<=n;i++){ sum+=fenzi*1.0/fenmu; fenzi=fenmu+fenzi; fenmu=fenzi-fenmu

2021-08-09 18:13:41 97

原创 C语言习题(五)

21、//输入某年某月某日,判断这一天是该年的第几天#include<stdio.h>typedef struct Data{ int year; int month; int day;}Data;int calculate(Data data){ int num=0; switch(data.month-1){ case 11:num+=30; case 10:num+=31; case 9

2021-08-09 14:30:20 75

原创 C语言练习(四)

16、//用时间最短的方法将负数全部排在整数的前面#include<stdio.h>void sort(int arr[],int arrLength){ int low=0; int high=arrLength-1; while(low<high){ while(arr[high]>=0 && low<high){//从右往左找到第一个负数 high--; } .

2021-08-05 16:37:06 64

原创 C语言习题(三)

11、//鞍点:行最大,列最小//先找到某一行最大的元素,将其列下标保存(最大元素 and 其个数)//然后从最大值对应的列中找到最小值。如果最大值和最小值相同,即为鞍点//一行一行的处理#include<stdio.h>#define MAXSIZE_ROW 3#define MAXSIZE_COL 3//该函数用来找到索引为row的行的最大值元素的列下标及其个数void getMaxElemColIndex(int matrix[][MAXSIZE_COL],int

2021-08-04 18:18:17 84

原创 C语言习题(二)

6、//斐波那契数列#include<stdio.h>int fibo(int n){ if(n==1) return 1; if(n==2) return 1; return fibo(n-1)+fibo(n-2);}int main(){ int n; while(scanf("%d",&n)&&n!=-1){ for(int i=1;i<=n;i++){ print

2021-08-03 20:52:04 112

原创 C语言习题(一)

1、//从键盘输入一个整数,判断该数是否为素数#include<stdio.h>#include<math.h>int isPrime(int number){ if(number==1){ return 0; } int m=sqrt(number); for(int i=2;i<=m;i++){ if(number%i==0){ return 0; }.

2021-08-02 15:14:15 80

原创 指针与数组

#include<stdio.h>void func(){ int iVar=0; int *p=&iVar; printf("1:%d\n",++(*p));//等价于(*p)=(*p)+1 //iVar的值变为1 printf("%d\n",(iVar++,1+iVar));//输出3 //iVar的值变为2 (*p)++; //iVar的值变为3 printf("2:%d\n",*p);//此时,p是.

2021-08-01 18:55:13 63

原创 单链表(一)

1.头插法 尾插法#include<stdio.h>#include<stdlib.h>typedef struct LinkNode{ int data; struct LinkNode *next;}LinkNode,*LinkList;//头插法建立单链表void createLinkList(LinkList &L,int enterArra[],int enterArraLength){ L=(LinkNode *)ma.

2021-08-01 14:58:07 176

原创 第九章 结构体

1.定义结构体类型#include <stdio.h>#include <stdlib.h>int main(){ //声明一个结构体类型 //只是类型,相当于一个模型,并没有定义变量 //注意区分 结构体类型 和 结构体变量 struct Student { int num; char name[20]; char sex; }stu3,stu4; //结.

2021-07-04 18:49:57 191

原创 第7章 函数

一、定义函数二、调用函数三、对调用函数的声明和函数原型四、函数的嵌套调用五、函数的递归调用六、数组作为函数参数数组名作为函数实参时,向形参(数组名或指针)传递的是数组首元素的地址。float average(float array[],int n);二维数组作为函数参数:#include <stdio.h>int max(int array[][4]) //求3x4矩阵所有元素最大值{ int i,j,max=array[0][0];

2021-05-26 10:40:19 106

原创 第6章 数组

1.一维数组#include <stdio.h>int main(){ //一维数组的定义 int a[10]; //一维数组初始化 int a[10]={0,1,2,3,4,5,6,7,8,9}; //后面5个元素为0 int a[10]={0,1,2,3,4} //数组元素全部赋成0 int a[10]={0}; //数组长度为5 int a[]={1,2,3,

2021-05-22 11:45:16 54

原创 第5章 循环结构程序设计

5.1 while、do while、for5.2 break和continue

2021-05-20 09:47:13 39

原创 第4章 选择结构程序设计

4.1关系运算符和关系表达式4.2逻辑运算符和逻辑表达式4.3if4.4 switch#include <stdio.h>int main(){ char grade; scanf("%c",&grade); printf("Your score:"); switch(grade) { case 'A': printf("85~100\n");break; case 'B': ...

2021-05-19 11:07:28 39

原创 第3章 顺序程序设计

#include <stdio.h>int main(){ float f,c; f=64.0; c=(5.0/9)*(f-32); printf("f=%f\nc=%f",f,c); return 0;}

2021-05-19 09:18:48 48

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除