- 博客(35)
- 资源 (2)
- 收藏
- 关注
原创 ZYNQ 7000系列处理器平台基于BusyBox制作根文件系统
1 下载BusyBox 下载链接:Index of /downloadshttps://busybox.net/downloads/源代码解压缩,并进入到源码目录 执行完上面操作后,源代码同级目录下会生成_install目录,通过cd命令进入_install目录下,添加需要的其他目录。2 创建etc/fstab文件,添加以下内容3 创建etc/inittab文件4 创建etc/passwd文件5 创建etc/init.d/rcS文件至此,rootfs文件系统算是创建完成了
2024-10-14 18:15:39
285
原创 Centos7安装WPS打开无反应
1、下载升级文件:wget http://mirrors.ustc.edu.cn/gnu/libc/glibc-2.18.tar.gz。8、检查:strings /usr/lib64/libc.so.6 | grep GLIBC_2.1。6、编译项目make -j4。
2022-08-23 17:18:18
1820
原创 VLC is not supposed to be run as root
This error says straight forward vlc can not be run as root privileged user. What to do now? Don’t be panic. Here is the hacked solution :-Dvi /usr/bin/vlcsearch for geteuid and replace it with getppidSave file & Exit.Now it should work, try to run it ag
2022-08-23 16:09:00
261
原创 堆排序(大顶堆)
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#define swap(a, b) { \ __typeof(a) __temp = a;\ a = b; b = __temp;\}void downUpdate(int *arr, int n, int ind) { while ((ind << 1) <= n) {.
2021-10-02 00:01:03
115
原创 单播组播共用一个端口号
让同一个端口号,既可以接收单播也可以接收组播的方法!/************************************************************************* > File Name: udp.c > Author: huochuanfei > Mail: 597092440@qq.com > Created Time: 2021-05-21 14:22:28 ******************************
2021-05-21 17:48:22
2290
1
原创 systemctl配置CENTOS7.5进程上电自起
1.写好脚本[root@localhost sq]# cat switch.service [Unit]Description=switchAfter=network.target[Service]ExecStart=/root/switch/NMS/switchExecStop=kill -INT `cat /tmp/switch.pid`[Install]WantedBy=multi-user.target2.保存目录以755的权限保存在目录:/usr/lib/system
2021-03-22 17:41:09
312
1
原创 Centos安装问题解决
scsi 0:0:0:0 alua: not attached1, 等一会,让系统执行到#出现的命令行,查看安装盘路径,ls /dev/sd*;我的是/dev/sdb42,开始安装,在进入安装界面,显示 Install CentOS 7 的这个界面的时候,选择第二个选项,按e编辑启动项,将vmlinuz initrd=initrd.imginst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet 改为:vmlinuz initrd=in
2021-03-22 11:08:36
5932
原创 图存储与最短路径2
最短路径:1,贝尔曼·富德-bellman·ford:单元最短路,暴力遍历每条边去更新答案。不能有负环根据s已知的答案去更新e的答案:s-v->e: ans[e] = min(ans[e], ans[s]+v)复杂度O(nxm) n:节点数 m:边数#include <iostream>#include <cstring>#include <cstdio>using namespace std;struct edge { int s,
2021-03-06 16:55:13
228
1
原创 图存储与最短路径1
图的概念:点和边组成的集合边的方向:有向边:有向图;无向边:无向图;边的权值:可以为负数和正数点的度:度 = 出度 + 入度图的存储:邻间矩阵 => 二维数组
2021-02-28 23:03:05
210
原创 libpcap交叉移植
1、下载libpcap-1.6.2.tar.gz 百度名字应该就能下载到,并解压缩至任意目录 2、打开终端,进入目录libpcap-1.6.2,这里要使用arm-linux-gcc进行编译,所以首先执行 export CC=arm-linux-gcc,注意以下操作需在此终端下执行,若终端挂掉了,需要重新执行第2步。 3、配置。执行 ./configure --host=arm-linux --with-pcap=linux,几秒后执行结束。 
2021-01-19 17:43:36
508
原创 Problem 18 数塔最大路径和
7595 6417 47 8218 35 87 1020 04 82 47 6519 01 23 75 03 3488 02 77 73 07 63 6799 65 04 28 06 16 70 9241 41 26 56 83 40 80 70 3341 48 72 33 47 32 37 16 94 2953 71 44 65 25 43 91 52 97 51 1470 11 33 28 77 73 17 78 39 68 17 5791 71 52 38 17 14 91 4
2020-12-30 15:10:43
216
原创 Problem 15 网格路径
对于20x20的网格,从左上角到右下角的所有路径条数;典型的递推问题。1 DP解法:#include <iostream>using namespace std;long long dp[25][25];int main() { for (int i = 1; i <= 21; i++) { for (int j = 1; j <= 21; j++) { if (i == 1 && j == 1) { dp[i][j] = 1;
2020-12-30 14:16:03
251
原创 大整数减法
#include <iostream>#include <cstring>using namespace std;char num1[1005], num2[1005];int n1[1005], n2[1005], ans[1005];int main() { cin >> num1 >> num2; n1[0] = strlen(num1); n2[0] = strlen(num2) - 1; ans[0] = max(n1[0],
2020-12-30 13:13:07
170
原创 大整数乘法
#include <iostream>#include <cstring>using namespace std;char num1[1005], num2[1005];int n1[1005], n2[1005], ans[1005];int main() { cin >> num1 >> num2; n1[0] = strlen(num1); n2[0] = strlen(num2); ans[0] = n1[0] + n2[0] -
2020-12-29 23:11:27
140
原创 Problem 25 1000位斐波那契数(大整数加法)
斐波那契数列是按如下递归定义的数列:F1 = 1 F2 = 1 Fn = Fn-1 + Fn-2在斐波那契数列中,第一个包含1000位数字的是第几项?#include <iostream>using namespace std;int func(int *n1, int *n2) { n2[0] = n1[0]; for (int i = 1; i <= n2[0]; i++) { n2[i] += n1[i]; if (n2[i] > 9) { n
2020-12-29 15:47:13
335
1
原创 Problem 2 偶斐波那契数
斐波那契数列中的每一项都是前两项的和。由和开始生成的斐波那契数列的前项为:1, 2, 3, 5, 8, 13, 21, 34, 55, 89,…考虑该斐波那契数列中不超过四百万的项,求其中为偶数的项之和。#include <iostream>using namespace std;#if 0int num[1000000];int main() { long long ans = 2; num[1] = 1, num[2] = 2; for (int i = 3; 1; i+
2020-12-29 15:28:09
183
原创 Problem 13 大和
1,输入数字,并将数字倒序存储2,对齐后相加3,处理进位4,输出答案#include <iostream>#include <cstring>using namespace std;char num1[1005], num2[1005];int n1[1005], n2[1005], ans[1005];int main() { cin >> num1 >> num2; n1[0] = strlen(num1); n2[0] = s
2020-12-29 15:17:40
131
原创 二分查找
#include <stdio.h>#include <inttypes.h>#define P(func) \ printf("%s = %d\n", #func, func);int binary_search(int *num, int n, int x) { int head = 0, tail = n - 1, mid; while (head <= tail) { mid = (head + tail) >> 1; if (num
2020-12-05 23:17:45
120
原创 哈希表
#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct Node { char *str; struct Node *next;} Node;typedef struct HashTable { Node **data; int size;} HashTable;Node *init_node(char *str, Node *head) { Node *p
2020-12-05 23:16:34
123
原创 顺序表及扩容
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <inttypes.h>#include <time.h>typedef struct Vector { int *data; int size; int length;} Vec;Vec *init(int n) { Vec *v = (Vec *)malloc(sizeof(Vec));
2020-12-05 23:14:06
497
原创 循环队列及扩容
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>typedef struct Queue { int *data; int head; int tail; int length; int cnt;} Queue;Queue *init(int n) { Queue *q = (Queue *)malloc(sizeof(Queue));
2020-12-05 23:04:33
535
1
原创 森林与并查集
#include <stdio.h>#include <stdlib.h>#include <stdio.h>//路径压缩#define swap(a, b) { \ __typeof(a) __temp = a;\ a = b, b = __temp;\}typedef struct UnionSet { int *father;//, *size; int n;} UnionSet;UnionSet *init(int n) { Un
2020-12-05 23:00:29
131
原创 优先队列
#define swap(a, b) {\ __typeof(a) __temp = a;\ a = b, b = __temp;\}typedef struct priority_queue { int *data; int cnt, size;} priority_queue;priority_queue *init(int n) { priority_queue *q = (priority_queue *)malloc(sizeof(priority_queue)); q-.
2020-12-05 22:58:37
142
原创 非稳定排序
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>#define swap(a, b) { \ __typeof(a) __temp = a; \ a = b, b = __temp; \}#define TEST(arr, n, func, args...) { \ int *num = (int *)malloc(sizeof(int) *
2020-12-05 22:56:22
258
原创 稳定排序
#define swap(a, b) {\ a ^= b, b ^= a, a ^= b; \}#define TEST(arr, n, func, args...) { \ int *num = (int *)malloc(sizeof(int) * n);\ memcpy(num, arr, sizeof(int) * n);\ output(num, n);\ printf("%s = ", #func);\ func(args);\ output(num, n);\ free.
2020-12-05 22:54:06
144
原创 二叉排序树
二叉排序树:根节点大于左子节点,但小于右子节点顺序: 左 > 根 >右#include <stdio.h>#include <stdlib.h>#include <time.h>typedef struct Node { int data; struct Node *lchild, *rchild;} Node;typedef struct Tree { struct Node *root; int n;} Tree;Node
2020-11-22 22:20:12
250
原创 广义表转二叉树
广义表转二叉树广义表 A(B(,D),C(E,)) 转出为:前序: A B D C E中序: B D A E C后序: D B E C Atypedef struct Node { char data; struct Node *lchild, *rchild;} Node;typedef struct Tree { Node *root; int n;} Tree;typedef struct Stack { Node **data; int top, size;
2020-11-22 00:10:06
2316
3
原创 高维数组传参-C语言
高维数组传参高维数组传参,最多只能省略一级二维数组:#include <stdio.h>int func( int (*a)[200]) { a[1][1] = 123; return 0;}int main() { int arr[100][200] = {{0}, {0}}; func( arr); printf("arr[1][1]: %d\n", arr[1][1]); return 0;}三维数组:#include <stdio.h>
2020-10-16 15:02:06
451
原创 牛顿迭代算法实现-C语言
牛顿迭代用于一元高次方程求解例如:y=x∗x−5=0例如: y = x * x - 5 = 0例如:y=x∗x−5=0#include <stdio.h>#include <math.h>double F(double x, double n) { return (x * x - n);}double f(double x) { return 2 * x;}double newton(double (*F)(double, double), double
2020-10-15 14:21:22
242
原创 二分查找算法实现及使用-C语言
折半查找(二分查找)在单调的区间里查找一个数值X,如果存在返回下标。复杂度logNint binary_search(char *arr, int n, int x) { int head = 0, tail = n - 1, mid; while (head <= tail) { mid = (head + tail) >> 1; if (arr[mid] == x) return mid; if (arr[mid] < x) head = mid + 1;
2020-10-12 17:00:24
265
原创 线性筛算法实现-C语言
线性筛1,标记一个范围内的数字是否是合数,没有被标记的则为素数2,算法空间复杂度O(N),时间复杂度O(N)3,总体思想是用一个整数M去标记合数N,其中N和M具有如下性质 1)N中最小的素因子数为P 2)N可以表示为P * M 3)P一定小于等于M中最小的素因子 4)利用M * P‘(所有不大于M中最小素数的集合)标记N1,N2,N3 … …#include <stdio.h>#define MAX_N 100int prime[MAX_N + 5];void
2020-10-10 17:28:20
713
原创 素数筛算法实现-C语言
素数筛1,标记一个范围内的数字是否是合数,没有被标记的则为素数2,算法的空间复杂度为O(N),时间复杂度为O(N * loglogN)3,总体思想是用素数去标记掉不是素数的数字,例如我知道i是素数,那么2i,3i,4i …就都不是素数一句话:用素数标记合数#include <stdio.h>#include <inttypes.h>#define MAX_N 100int prime[MAX_N + 5];void init() { for (int i =
2020-10-10 10:11:40
459
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人