算法
永恒sss
这个作者很懒,什么都没留下…
展开
-
朴素算法BF,KMP算法
朴素算法//朴素算法 BF算法 :1.同时向后跑 2.如果相等i++ j++ 3.如果不相等i=i-j+1 j=0 int BF_Search(const char* str, const char* sub, int pos)//从主串的pos下标开始向后找字串{ assert(str != NULL && sub != NULL && pos >= 0 && pos < strlen(str)); if (str == NULL原创 2022-03-16 14:56:25 · 355 阅读 · 0 评论 -
BST树相关函数
#include<stdio.h>#include<assert.h>#include<iostream>#include<Windows.h>#include<queue>using namespace std;// map rb_tree;//树的结构typedef int KeyType;typedef struct BstNode{ KeyType key; BstNode* leftchild; BstNode*原创 2022-03-12 02:37:26 · 521 阅读 · 2 评论 -
二叉树遍历
二叉树数据结构typedef char Elemtype;typedef struct BtNode{ Elemtype data; struct BtNode* leftchild; struct BtNode* rightchile;}BtNode,*BinaryTree;二叉树中序遍历 递归//中序遍历void InOrder(BtNode* p)//ABC##DE##F##G#H##{ if (p != NULL) { InOrder(p->leftchild原创 2022-03-07 01:05:30 · 485 阅读 · 0 评论