- 博客(7)
- 收藏
- 关注
原创 木块问题 (UVA 101,The Block Problem)(C++实现)
UVA 101 木块问题 题目描述 Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning and robotics (STRIPS) used a block world in which a robot arm performed tasks involving the
2021-10-20 22:10:19
648
原创 (C语言)线索二叉树的遍历与线索化(ThreadTree)
// 后序 中序遍历时访问节点的顺序决定前驱后继 // 增加两个指针域 forward backward 分别指向前驱与后继 // 或 增加两个指示点(Tag)0表示指向下一个树,1表示前驱 // 在一次遍历中完成前驱后继的寻找 #include <stdio.h> #include <stdbool.h> typedef int TElemType; typedef enum PointerTag {Link,Thread}; // Link=0:指针, Thread=1:线
2021-08-05 11:40:59
426
原创 数据结构——二叉树(BinaryTree)
二叉树 (1)定义 // BinaryTree // 1. 二叉树第 i 层最多有2^(i-1)个节点 // 2. 深度为k的二叉树最多有2^k - 1 个节点 // 3. 对任意的二叉树T,如果终端节点数为n0 度为2的结点数为n2 则有 n0 = n2 + 1 // 完全二叉树 // 4. 具有n个节点的二叉树的深度为 floor(log2(n))+1 // 5. (1) 节点i的parent为 floor(i/2) // 5. (2) 若2i>n,则节点无leftchild否则leftchild
2021-07-16 10:14:46
426
原创 数据结构——栈类型(Stack)
#ifndef malloc #include <stdlib.h> #endif #ifndef bool #include <stdbool.h> #endif #define STACK_INIT_SIZE 10 // 存储空间初始分配量 #define STACK_INCREMENT 2 // 存储空间分配增量 #ifndef OK #define OK 1 #endif #ifndef ERROR #define ERROR 0 #endif #define OVERF
2021-07-16 10:10:15
287
原创 数据结构——队列(queue)
#include <stdio.h> #include <stdbool.h> #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif //#define OK 1 //#define ERROR 0 #define Status bool // 调用程序应包含标准工具库 // typedef unsigned long size_t; // extern void *malloc(size_t __size); // extern
2021-07-16 10:09:14
277
原创 改进的字符串模式匹配算法——KMP操作(C语言)
改进的字符串模式匹配算法——KMP操作前言一、一般的模式匹配算法二、KMP算法的基本思想1.一般方法的弊端2.解决想法3.数学解释4.next()详解(1)解剖next()函数总结 前言 关于什么是CMP操作,详情见 KMP算法 一、一般的模式匹配算法 int Index_S (SString S,SString T,int pos){ int i,j; i = pos; j=1; while(i<= S[0] && j <= T[0]){
2021-04-23 17:13:22
851
原创 数据结构——定长顺序存储表示的串(c语言)
数据结构——定长顺序存储表示的串(c语言)引用的标准库基本定义基本操作生成一个其值等于chars的串T由串S,复制得串T判断串S是否为空字符串比较字符串长度字符串清空字符串连接字符串子串字符串匹配(一般方法)字符串插入子串删除替换所有子串字符串输出 引用的标准库 #include <string.h> //不引用string库也可以,不过要自己手动实现部分操作 #include <stdbool.h> 关于<stdbool.h> 见 c语言stdbool.h 基本定义
2021-04-23 12:28:07
1785
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅