随笔分类 - 数据结构
摘要:#include <iostream.h> void Union(int A[ ], int n, int B[ ], int m, int C[ ] ); int main() { int i, C[12]; int A[5] = {1, 3, 5, 7, 9}; int B[7] = {2, 3
阅读全文
摘要:冒泡排序原理: 一种排序的方式,对要进行排序的数据中相邻的数据进行两两比较,将较大的数据放在后面,依次对所 有的数据进行操作,直至所有数据按要求完成排序 。 如果有n个数据进行排序,总共需要比较n-1次每一次比较完毕,下一次的比较就会少一个数据参与 假如有如下身高的小人: 相邻的两个两两相比较,前者
阅读全文
摘要:仅供参考 1 #include "stdio.h" 2 #include "stdlib.h" 3 #include "iomanip.h" 4 #include "time.h" 5 #include "iostream.h" 6 const int N=150000; 7 #define Ele
阅读全文
摘要:1 #include "stdio.h" 2 #include "iostream" 3 #include "stdlib.h" 4 #include "time.h" 5 6 const int size=1000; 7 typedef long RecType; 8 typedef struct
阅读全文
摘要:1 #include "stdio.h" 2 #define MaxVertexNum 20 //定义图的最大顶点数 3 #define MaxEdgeNum 50 //定义图的最大边数 4 #define MaxValue 1000 //定义MaxValue为全局整型常量,作为无穷大 5 type
阅读全文
摘要:1 #include "stdio.h" 2 #include "malloc.h" 3 typedef int datatype; 4 typedef struct node //定义链式栈结构 5 { datatype data; 6 struct node *next; 7 }StackNod
阅读全文
摘要:1 #include"stdio.h" 2 #include"malloc.h" 3 typedef int datatype; 4 5 #define MAXSIZE 50 //队列的最大容量 6 //定义队列结构体 7 typedef struct 8 { 9 datatype data[MAX
阅读全文
摘要:二叉树 建立二叉树,先序、中序、后序、层次的遍历此二叉树,并求叶子结点个数、树的高度( 用递归或非递归的方法都可以)。 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include<conio.h> 4 #define ERROR 0 5 #define
阅读全文
摘要:*问题描述:一堆猴子都有编号,编号是1,2,3 ...m ,这群猴子(m个)按照1-m的顺序围坐一圈,从第1开始数,每数到第N个,该猴子就要离开此圈,这样依次下来,直到圈中只剩下最后一只猴子,则该猴子为大王。 *输入数据:输入m,n。要求 m,n 为整数,n<m。 *输出形式:中文提示按照m个猴子,
阅读全文
摘要:1 #include "stdio.h" 2 #include "malloc.h" 3 #define datatype int 4 typedef struct node 5 { 6 datatype data; //链表的数据域 7 struct node *next; //链表的指针域 8
阅读全文

浙公网安备 33010602011771号