- 博客(12)
- 收藏
- 关注
原创 为图2建立邻接表存储结构,并对实验所建立的邻接表进行深度优先遍历。/验证实验/
#include<stdio.h>#include<iostream.h>#define MAX 100#define N 100typedef struct{ char v[N];}A;typedef struct node //邻接表表结点{ int adjvex; //...
2022-08-23 15:52:12
197
原创 IT从业者的冥想入门指南(精简版)
希望你我能够通过冥想,在人世间一切让人感到繁忙焦虑的环境中,自建一块栖息静地,坦然地面对。祝我们在各种不得不做的事情中也能得到休息和快乐。
2022-08-23 15:46:38
220
1
原创 为下图建立邻接矩阵存储结构,并对实验所建立的邻接矩阵进行深度优先遍历。/验证实验/
#include<stdio.h>#include<iostream.h>#define MAX 100#define N 100/**************************************************************************/typedef struct{ char v[N];}V;typedef struct /...
2018-06-25 09:36:06
1558
原创 农夫需要总长为L的N块木头,每块木头长度为Li(Li为整数,且∑Li=L)。农夫购买了长度为L的木头,请人锯成N块,假设锯木的酬金为这段木头的长度,请编写程序帮助农夫计算将木头锯成N块的最少花
#include<stdio.h>#include<stdlib.h>void puts(int a[],int N){ printf("请分别输入要锯成的%d块木头的长度:\n",N); for(int i=0;i<N;i++) scanf("%d",&a[i]);}void paixu(int a[],int N){ int max...
2018-06-25 09:31:13
1836
1
原创 对所示的二叉树建立二叉链表存储结构。中序遍历所建立的二叉树,并计算该二叉树的深度及叶子结点个数。/验证实验/
#include <iostream.h> #define MAXSIZE 100 typedef char ElemType; typedef struct BiTNode{ ElemType data; struct BiTNode *lchild,*rchild; } BiTNode,*BiTree; void CreateBiTree1(BiTr...
2018-06-25 09:27:54
3026
原创 用“三元组表”存储稀疏矩阵,并对矩阵进行转置。/验证实验/
#include<stdio.h>#include<stdlib.h>#define MAX 12typedef int datatype;typedef struct{ int i, j; //行号、列号 datatype v; //元素值} node;typedef struct{ int m, n, t; //行...
2018-06-25 09:13:15
2681
原创 输入一个由若干单词组成的文本行,每个单词之间用若干个空格隔开,统计此文本中单词的个数。/验证实验/
#include<iostream> using namespace std; struct st { char str[100]; int n; //存个数 }b[100]; //all words in this centence should be store in every characters, and the longest word...
2018-06-25 09:12:08
12199
1
原创 采用顺序存储实现队列的初始化、入队、出队操作。/验证实验/
#include<iostream.h>#define maxsize 100typedef struct queue{int data[maxsize];int head;int tail;}Queue;void init(Queue *l){ l->head=-1; l->tail=-1;}void empty(Queue l){ if(l.head==-1&a...
2018-06-25 09:10:50
2137
原创 采用顺序存储实现栈的初始化、入栈、出栈操作。/验证实验/
#include<stdio.h> #include<stdlib.h> #define maxsize 100 typedef struct SqStack{ int data[maxsize]; int top; }SqStack; void SqStackEmpty(SqStack *st)//判断栈是否为空{ st->to...
2018-06-25 09:09:22
5326
原创 一元多项式求导。/设计实验/
#include<iostream.h>#include<stdio.h>#include <stdlib.h>typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}Lnode,*Linklist;void Create(Linklist &L,in...
2018-06-25 09:07:55
722
原创 建立一个单链表,并实现插入、删除、查找操作。/验证实验/
#include<iostream.h>typedef int ElemType;typedef struct lnode{ ElemType data; struct lnode *next;}Lnode,*Linklist;void CreateList(Linklist &L,int n){ L=new Lnode; L->data=NU...
2018-06-25 09:06:29
4328
原创 一个顺序表,并实现插入、删除、查找操作。/验证实验/
#include<iostream.h>#include<stdlib.h># define maxsize 50 typedef struct {int a[maxsize]; int size;}sqlist; void Initlist(sqlist &L,int n)//建立顺序表{ int i; cout<<"输入...
2018-06-25 09:04:19
1972
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人