![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
文章平均质量分 50
wfx_code
这个作者很懒,什么都没留下…
展开
-
PTA习题11-6 查找子串(利用指针可极大精简代码与时间复杂度、10行内解决问题)
无法通过全部测试数据,在存在多个最短t的数据时答案错误,但经测试多个数据无法发现错误,希望能有人能发现问题在哪里并予以指正 微信:wfx_code 本题要求实现一个字符串查找的简单函数。 函数接口定义: char *search( char *s, char *t ); 函数search在字符串s中查找子串t,返回子串t在s中的首地址。若未找到,则返回NULL。 裁判测试程序样例: #include <stdio.h> #define MAXS 30 char *searc..原创 2021-03-27 14:00:35 · 308 阅读 · 0 评论 -
PTA 6-12 二叉搜索树的操作集 (重点记录删除节点)
本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: BinTree Insert( BinTree BST, ElementType X ); BinTree Delete( BinTree BST, ElementType X ); Position Find( BinTree BST, ElementType X ); Position FindMin( BinTree BST ); Position FindMax( BinTree BST ); 其中BinTree结构定义如..原创 2021-03-23 23:08:50 · 308 阅读 · 0 评论 -
算法竞赛常用方法笔记(更新ing)
DFS深度优先遍历 DFS(dep,...) //dep带便目前DFS深度 { if(找到解||走不下去了) { ... return; } 枚举下一种情况,DFS(dep+1,...) } BFS广度优先遍历 通常用队列(先进先出)实现 初始化队列Q. Q={起点s};标记s为已访问 while(Q非空){ 取Q队首元素u;u出队; if(u==目标状态){...} 所有与u相邻且未被访问的点进入队列 标记u为已访问; } //匹配正则 String[.原创 2020-11-02 22:36:34 · 202 阅读 · 0 评论 -
JAVA Arrays.sort()自定义Comparator
例:将一组单词按照字典序输出 Five of the notes have two two two alternate equals sign Thus there are are are String str = "Five of the notes have two two two alternate equals sign Thus there are are are"; //去除空格,保存为字符串数组类型 String[] arr...原创 2020-11-01 23:37:36 · 1978 阅读 · 0 评论