摘要: 归并排序 1.思路 通过不断的划分区域,使其每个区域独自有序,为后续的合并埋下伏笔。由于两个区域是有序的,合并的时候就会降低排序的时间复杂度。 2.代码 2.1递归思想 #include<stdio.h> #include<stdlib.h> int n; int* a; void init() { 阅读全文
posted @ 2022-10-14 21:58 彭乐祥 阅读(36) 评论(0) 推荐(0)
摘要: #一.描述 ###打印一个n行的实心菱形。 #二.核心代码 ###1.多个循环 ####1.1.代码 void print() { for (int i = 0; i < n; i++) { for (int j = 0; j < abs(n / 2 - i); j++) printf(" "); 阅读全文
posted @ 2022-10-13 11:33 彭乐祥 阅读(98) 评论(0) 推荐(0)
摘要: ###一.编写原因 ####分析算法中,发现之前对于for循环理解很浅薄,只了解到循环体循环的次数。今天回过头,梳理了一下。 ###二.大贴图 ###三.理解 #####1.实践出真知,先上代码 #include<stdio.h> int main() { int count = 0; int co 阅读全文
posted @ 2022-10-11 22:31 彭乐祥 阅读(951) 评论(0) 推荐(0)
摘要: #一.题目 ###1.缩短指针的距离 int maxLengthBetweenEqualCharacters(char * s){ int length=strlen(s); int right=length-1; int temp; int left; while(right>0){ temp=r 阅读全文
posted @ 2022-09-17 21:38 彭乐祥 阅读(25) 评论(0) 推荐(0)
摘要: ###题目: ####一.交换 void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; } void moveZeroes(int* nums,int numsSize) { if (numsSize == 1&&numsSize 阅读全文
posted @ 2022-09-09 11:16 彭乐祥 阅读(13) 评论(0) 推荐(0)
摘要: ————参考博客(推荐看这篇博客,非常全) 1.三数取中(也可以5个数甚至更多) #include<stdio.h> #define Max 100 //储存的最大值 void Swap(int *A,int *B) { int temp = *A; *A = *B; *B = temp; } in 阅读全文
posted @ 2022-05-01 14:57 彭乐祥 阅读(245) 评论(0) 推荐(0)
摘要: #时间片轮询算法 ###一.代码 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #define n 10//进程名最大长度 #define MAX 5//进程数 //定义进程类型 typedef struct 阅读全文
posted @ 2022-05-01 14:52 彭乐祥 阅读(173) 评论(0) 推荐(0)
摘要: #一.排序 ###1.快速排序代码 #include<stdio.h> #define Max 100 //储存的最大值 int Sort(int A[],int head,int end) { int Standard = A[head]; //标准值为最左边的数 while (head < en 阅读全文
posted @ 2022-03-27 16:43 彭乐祥 阅读(70) 评论(0) 推荐(0)
摘要: #操作系统 ###一.操作系统的概念 ####操作系统是指控制和管理整个计算机系统的硬件与软件资源,合理地组织、调用计算机的工作与资源的分配,进而为用户和其他软件提供方便接口与环境的程序集合。操作系统是计算机系统中最基本的系统软件。 ###二.操作系统的特征 ####1.并发 :并发是指两个或多个事 阅读全文
posted @ 2022-03-17 22:48 彭乐祥 阅读(80) 评论(0) 推荐(0)
摘要: | 这个作业属于哪个课程 | 班级的链接 | | | | | 这个作业要求在哪里| 作业要求的链接 | | 这个作业的目标 | 指针字符串的理解与运用 | | 学号 | 20209014 | #一、本周作业(总分:20分) ###1.1 完成PTA作业,并给出编程题完成截图(5分) ##1.2 请给 阅读全文
posted @ 2021-05-05 14:30 彭乐祥 阅读(59) 评论(0) 推荐(0)