线性表(动态分配 逆置、排序)
结构:线性表动态分配顺序存储结构
目的:逆置
代码如下:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192#include<stdio.h>#include<stdlib.h>#include<time.h>#include<iostream> using namespace std;#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define OVERFLOW -2#define LIST_INIT_SIZE 100#define LISTINCREMENT 10 typedef int Status;typedef int ElemType; typedef str ...
稀疏矩阵
教材:严版数据结构
页码:P99
IDE:VS2015
代码如下:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128#include<iostream>#include<stdlib.h>#include<time.h>using namespace std; #define MU 5#define NU 6#define Status int#define ElemType int #define ERROR 0#define OK 1#define ...
特征选择与稀疏学习
特征(feature)
相关特征(relevant feature)
无关特征(irrelevant feature)
特征选择(feature selection)
从给定的特征集合中选择出相关特征子集的过程
冗余特征(redundant feature)
“前向”搜索
逐渐增加相关特征的策略
“后向”搜索
每次尝试去掉一个无关特征,逐渐减少特征
“双向”搜索
将前向和后向搜索结合起来
栈(实现、应用)
教材:严版数据结构
页码:P46
实现:
初始化顺序栈
创建顺序栈
判断栈空
输出顺序栈
取栈顶元素
入栈
出栈
代码如下:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134#include<stdio.h>#include<iostream>#include<stdlib.h>#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define OVER ...
查找(二叉排序树)
教材:严版数据结构 P227-231
实现:算法9.5-9.8
代码如下:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891 ...
数组(顺序存储)
教材:严版数据结构
IDE: VS2015
代码如下:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121#include<iostream>#include<stdarg.h> using namespace std; #define MAX_ARRAY_DIM 8#define ElemType int#define Status int#define ERROR 0#define OK 1#define FALSE 0#define TRUE 1 typedef struct { Ele ...