摘要:插入排序 是一种对原有序列排序的方法,逐步使原序列的有序序列增长折半插入排序 是在寻找 当前元素的位置时采取了折半查找的方法#include"stdio.h"
#include"stdlib.h" typedef struct SqList{ int * elem; int length; int MaxSize;
}SqList; void CreatList(SqList &L)
{ L.elem=(int *)malloc(100 * sizeof(int)); if(!L.elem) exit(0); else { L.length =
阅读全文
摘要:今晚整那个ubuntu,什么也没弄成,唉,把算法先保留一下吧, 插入函数还没理解透彻呢#include<stdio.h>
#include<stdlib.h> #define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define NULL 0 typedef int Status;
typedef int ElemType;
typedef int KeyType; typedef struct BSTNode{ Ele...
阅读全文
摘要:二叉排序树BST 原则就是小的话接左边,大的话接右边,必须说的是效率太低主要是刚开始理解错了不需要再写什么Creat函数的,直接搜着插着就能进行#include<stdio.h>
#include<malloc.h> #define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define NULL 0 typedef int ElemType;
typedef int Status;
typedef int KepType;
...
阅读全文
摘要:小问题却整了这么久,能力有待加强,要强烈区分三元组的列数与元素总数,不能将他俩写混了#include<stdio.h> #define MAXSIZE 1250 #define OK 1
#define ERROR 0
#define TRUE 1
#define FLASE 0 typedef int Status;
typedef int ElemType; typedef struct{ int i, j; //该非零元的行下标和列下标 ElemType e; //非零元对...
阅读全文
摘要:递归简直太难了啊 #include<stdio.h>
#include<malloc.h> #define OK 1
#define ERROR 0
#define TRUE 1
#define FLASE 0
#define OVERFLOW 2 typedef int Status;
#define TElemType char typedef struct BiTNode{ TElemType data; struct BiTNode * lchild, * rchild; ...
阅读全文
摘要:这些都是头函数里的内容,也就是保存之后,可以直接对其进行调用。其中的一个变量stacklen是用来记录栈的长度的,其实,这个变量可以不要,只是刚开始写时给它加上了,所以就按这样写了,感觉跟顺序表的写法差不多#include<iostream>
#include<stdlib.h>
#include<malloc.h>
using namespace std; typedef int Status;
typedef int SElemType; # define OK 1
# define ERROR 0
# define TRUE 1
# define...
阅读全文
摘要:线性表的顺序表示终于马马虎虎的勉强写完了,写的不是很完整,开始时比较不理解就是动态分配内存,现在懂一点点了,数据结构落下很多了,这几天要好好整了#include<iostream>
#include<stdlib.h>
#include<malloc.h>
using namespace std; #define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0 typedef int Status;
typedef int ElemType;
typede...
阅读全文