摘要: // 先序遍历(非递归) void PreOrder(BiTree T) { LinkStack S; InitStack(S); BiTree p = T; while(p || !IsEmpty(S)) { if(p) { visit(p); Push(S, p); p = p->lchild; 阅读全文
posted @ 2024-10-18 10:08 ericf 阅读(28) 评论(0) 推荐(0)
摘要: 暴力匹配BF算法从零开始: **** kmp算法从零开始: 从1开始王道上面标准代码 如何记忆? 就假设s=“abc”, t=“a”,带入进去比较下。 阅读全文
posted @ 2024-10-15 18:35 ericf 阅读(60) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; const int MAXSIZE = 20; typedef struct { char data[MAXSIZE]; int length; }String; void Init(String &s); void 阅读全文
posted @ 2024-10-15 10:55 ericf 阅读(29) 评论(0) 推荐(0)
摘要: 最大公约数和最小公倍数 题目描述 输入两个正整数m和n,求其最大公约数和最小公倍数。 输入格式 两个整数 输出格式 最大公约数,最小公倍数 样例输入 5 7 样例输出 1 35 #include<stdio.h> int gcd(int a, int b) { return b ? gcd(b, a 阅读全文
posted @ 2024-10-10 13:05 ericf 阅读(11) 评论(0) 推荐(0)
摘要: 三个数找最大值: 题目描述 有三个整数a b c,由键盘输入,输出其中的最大的数。 输入格式 一行数组,分别为a b c 输出格式 a b c其中最大的数 样例输入 10 20 30 样例输出 30 #include <stdio.h> int main() { int a, b, c; int m 阅读全文
posted @ 2024-10-10 12:54 ericf 阅读(27) 评论(0) 推荐(0)
摘要: 第一题:输出helloworld 学习了输出语句,请参照例题,编写一个程序,输出以下信息: ************************** Hello World! ************************** 注意:Hello与World之间有一个空格以及大小写问题 *也是输出的一部 阅读全文
posted @ 2024-10-10 10:11 ericf 阅读(20) 评论(0) 推荐(0)