算法
纵浪大化中,喜,惧
这个作者很懒,什么都没留下…
展开
-
提取objects365中的部分图像类别并转换为yolo输入格式
objects365提取部分类别并转化为哟咯输入格式原创 2021-12-04 11:58:53 · 1282 阅读 · 4 评论 -
根据前序遍历和中序遍历生成二叉树
#include<stdio.h>#include<stdlib.h>#include<algorithm>#include<stack>char Pre[70];char Mid[70];typedef struct TNode* BinTree;typedef BinTree Position;struct TNode { int Data; Position Left; Position Right;};void AfT(Bi.原创 2021-05-28 23:03:44 · 79 阅读 · 0 评论 -
KMP
KMP 串的模式匹配 (25 分)给定两个由英文字母组成的字符串 String 和 Pattern,要求找到 Pattern 在 String 中第一次出现的位置,并将此位置后的 String 的子串输出。如果找不到,则输出“Not Found”。本题旨在测试各种不同的匹配算法在各种数据情况下的表现。各组测试数据特点如下:数据0:小规模字符串,测试基本正确性; 数据1:随机数据,String 长度为105,Pattern 长度为10; 数据2:随机数据,String 长度为10...原创 2021-05-23 09:20:59 · 68 阅读 · 0 评论 -
表达式求值(递归用来解决递归的定义)
#include<stdio.h>#include<stdlib.h>#include<math.h>#include<string.h>#include<iostream>using namespace std;int Read_Expression();int Read_Term();int Read_Factor();bool IsDigit();int main(){ printf("%d", Read_Expre.原创 2021-05-09 20:09:53 · 119 阅读 · 0 评论 -
N皇后
递归方法#include<stdio.h>#include<stdlib.h>#include<math.h>int q[100] = { 0 };void Nqueen(int N, int K);int num = 0;int main(){ int N; scanf("%d", &N); Nqueen(N, 0); printf("%d", num);}void Nqueen(int N, int K){ int j;原创 2021-05-09 09:42:30 · 49 阅读 · 0 评论 -
2021-05-08
基础实验5-2.2 电话聊天狂人 (25 分)给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。输入格式:输入首先给出正整数N(≤105),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。输出格式:在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。如果这样的人不唯一,则输出狂人中最小的号码及其通话次数,并且附加给出并列狂人的人数。输入样例:413005711862 13588原创 2021-05-08 17:02:01 · 70 阅读 · 0 评论 -
2021-05-04
10-排序5 PAT Judge (25 分)The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file contains one test case. For each原创 2021-05-04 10:38:32 · 54 阅读 · 0 评论 -
2021-05-04
10-排序6 Sort with Swap(0, i) (25 分)Given any permutation of the numbers {0, 1, 2,...,N−1}, it is easy to sort them in increasing order. But what ifSwap(0, *)is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2, 1, 3} we may apply...原创 2021-05-04 10:36:51 · 44 阅读 · 0 评论 -
快速排序
分析一下总是错的原因:没用笔自己试一下#define CutOff 100#include<stdio.h>#include<stdlib.h>void QuickSort(int* a, int Left, int Right);int FindMedium(int* a, int Left, int Right);void QuickSortF(int* a, int n);void InsertSort(int* a, int Right, int Left)原创 2021-04-30 22:32:11 · 81 阅读 · 1 评论 -
C++Stl中的sort
#include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;struct Rule1 { bool operator()(const int& a1, const int& a2)const { return a1 % 10 < a2 % 10; }};struct Student { char .原创 2021-04-29 20:37:50 · 45 阅读 · 0 评论 -
2021-04-28
09-排序2 Insert or Merge (25 分)According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it be.原创 2021-04-28 17:56:34 · 45 阅读 · 0 评论 -
2021-04-28
09-排序3 Insertion or Heap Sort (25 分)According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the locatio.原创 2021-04-28 17:55:43 · 43 阅读 · 0 评论 -
选择排序插入排序冒泡排序二分搜索
#include<stdio.h>#include<stdlib.h>void BubbleSort(int* a, int size);void Choose_Sort(int* a, int size);void InsertSort(int* a, int size);int main(){ int a[5] = { 4,6,3,8,7 }; InsertSort(a, 5); for (int i = 0; i < 5; i++) { prin.原创 2021-04-22 21:46:01 · 63 阅读 · 0 评论