- 博客(21)
- 收藏
- 关注
原创 《数值分析》Taylor多项式逼近函数matlab
%Taylor多项式逼近函数%fun表示被逼近的函数f(x);n是Taylor多项式的次数%x0表示f(x)在该点做Taylor展开;x1表示在该点求函数f(x)的近似值function TaylorExp(fun,x0,n,x1) syms x; p=0; for i=0:n if i<=1 m=1; else m=m*i; end p=p+((x-x0)^.
2022-03-02 13:20:00 1345
原创 《数据结构》二叉树遍历
中序遍历的递归与非递归 #include <iostream> using namespace std; typedef struct BiTNode { int data; struct BiTNode *lchild,*rchild; } BiTNode,*BiTree; typedef struct StackNode{ BiTNode *t; struct StackNode *next;}StackNode,*LinkStack;bool I
2021-12-29 23:59:59 339
原创 《数据结构》顺序串的匹配
BF算法,KMP算法及其改进#include <iostream>using namespace std;#define MAXLEN 255int next[256];int nextval[256];typedef struct{ char ch[MAXLEN+1]; int length; }SString; int Index_BF(SString S,SString T,int pos) { int i,j; i=pos; j=1; whil
2021-12-28 20:41:20 238
原创 《数据结构》链队
链队的几个基本操作#include <iostream>using namespace std;typedef struct QNode{ int data; struct QNode *next;}QNode,*QueuePtr;typedef struct{ QueuePtr front; QueuePtr rear;}LinkQueue;bool Init(LinkQueue &Q){ Q.front=Q.rear=new QNode; Q.fr
2021-12-27 19:55:07 46
原创 《数据结构》循环队列
循环队列的几个基本操作#include <iostream>using namespace std;#define MAXSIZE 100typedef struct{ int *base; int front; int rear;}sqQueue;bool Init(sqQueue &Q){ Q.base = new int[MAXSIZE]; if(!Q.base) exit; Q.front=Q.rear=0; return true;}i
2021-12-27 19:54:00 594
原创 《数据结构》链栈
链栈的几个基本操作#include <iostream>using namespace std;typedef struct StackNode{ int data; struct StackNode *next;}StackNode,*LinkStack;bool Init(LinkStack &S){ S=NULL; return true;}bool Push(LinkStack &S,int e){ StackNode *p; p =
2021-12-26 22:58:08 270
原创 《数据结构》顺序栈
顺序栈的几个基本操作#include <iostream>using namespace std;#define MAXSIZE 100typedef struct{ int *base; int *top; int stacksize;}sqStack;bool Init(sqStack &S){ S.base = new int[MAXSIZE]; if(!S.base) exit; S.top=S.base; S.stacksize = MAX
2021-12-26 22:23:48 387
原创 《数据结构》线性表之单链表 双向链表
单链表的几个基本操作#include <iostream>using namespace std;typedef struct LNode{ int data; struct LNode *next;}LNode,*LinkList;bool Init(LinkList &L){ L= new LNode; L->next = NULL; return true; } void CreateList(LinkList L,int n) {//前插
2021-12-26 16:51:10 156
原创 《数据结构》线性表之顺序表
顺序表的几个基本操作#include <iostream>#include <cstdio>#define MAXSIZE 100using namespace std;typedef struct { int *elem; int length;}SqList;void Init(SqList &L){ L.elem = new int[MAXSIZE]; if(!L.elem) exit; L.length=0;}bool G
2021-12-26 15:50:34 235
原创 《python机器学习基础教程》代码实现 随机森林--分类
DecisionTreeClassifierfrom sklearn.tree import DecisionTreeClassifierfrom sklearn.tree import export_graphvizfrom sklearn.datasets import load_breast_cancerfrom sklearn.model_selection import train_test_splitimport graphvizimport matplotlib.pyplot
2021-11-23 22:28:31 1606
原创 《python机器学习基础教程》代码实现线性模型--分类
Logistic回归from sklearn.linear_model import LogisticRegressionfrom sklearn.datasets import load_breast_cancerfrom sklearn.model_selection import train_test_splitimport matplotlib.pyplot as pltcancer = load_breast_cancer()X_train,X_test,y_train,y_tes
2021-11-22 22:19:07 920
原创 《python机器学习基础教程》代码实现线性模型--回归
线性回归 (LinearRegression)from sklearn.base import TransformerMixinfrom sklearn.linear_model import LinearRegressionimport mglearnfrom sklearn.model_selection import train_test_splitX,y=mglearn.datasets.load_extended_boston()X_train,X_test,y_train ,y_
2021-11-18 21:52:44 809
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人