自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(72)
  • 资源 (5)
  • 问答 (1)
  • 收藏
  • 关注

原创 【力扣】两个链表的第一个公共节点:优雅的双指针

题目输入两个链表,找出它们的第一个公共节点。如下面的两个链表:在节点 c1 开始相交。分析思路和算法使用双指针的方法,可以将空间复杂度降至 O(1)O(1)。若headA 和 headB其中之一为空,则不相交,返回None;若均不为空,设两个新指针pA,pB分别指向 headA和headB,同时移动pA,pB。若pA/pB不为空,均移动到各自的下一个节点,否则pA指向headB,pB指向headA,直到pA 和pB指向同一个节点。论证求headA 的长度为m, h

2021-07-21 22:53:33 197 2

原创 Bert & Transformer 笔记

Bert & Transformer 笔记论文链接链接论文链接https://arxiv.org/pdf/1810.04805.pdfgithub: https://github.com/google-research/berthttps://github.com/tianxieeryang/pytorch-pretrained-BERT链接https://www.colabu...

2019-06-03 10:32:52 269

原创 NLP学习总结 持续更新中

NLP学习总结 持续更新中统计学习方法笔记CS229课程笔记CS224课程笔记优秀知乎统计学习方法笔记http://www.hankcs.com/ml/the-perceptron.htmlCS229课程笔记http://www.hankcs.com/tag/cs229/CS224课程http://space.bilibili.com/34967/video笔记http:/...

2019-04-11 09:52:39 307

原创 面试总结

面试总结算法算法1、动态规划背包问题(0/1背包 完全背包)2、表达式求值(中缀表达式)3、大文件中返回最高频的词语(hash)4、海量数据查找中位数(分割思想读入内存)5、给定一个整数分解成连续自然数之和,输出所有情况...

2019-03-26 15:22:40 156

转载 海量数据查找中位数

海量数据查找中位数现在 有10亿个int型的数字(JAVA中 int 型占4B),以及一台可用内存为1GB的机器,如何找出这10亿个数字的中位数?中位数定义:数字排序之后,位于中间的那个数。比如将10亿个数字进行排序(位置从1到10亿),排序之后,位于第5亿个位置的那个数 就是中位数。关于中位数,可参考:快速排序中的分割算法的解析与应用一种方法是定义一个长度为10亿的整型数组,采用排序算法...

2019-03-19 11:15:43 739 1

原创 python 类相关知识点总结

python 类相关知识点总结类的重写(override)和重载(overload)重写(override)重载(overload)新式类和经典类类的重写(override)和重载(overload)重写(override)重写:当子类在继承父类时,父类满足不了子类的需求,子类需要对父类做一些修改,叫做重写重载(overload)重载:指同一个类中,不同方法之间具有相同的方法名,但参数不...

2019-03-06 09:38:50 764

转载 linux配置磁盘阵列raid 0、raid1 、raid5 、raid6 、raid10、raid50、raid60原理

linux配置磁盘阵列raid 0、raid1 、raid5 、raid6 、raid10、raid50、raid60原理1 raid0的特性:2 raid1的特性:3 raid10的特性:4 raid5的特性:5 raid50的特性:6 raid6的特性:RAID6的性能:7 raid60的特性:简单总结文档链接1 raid0的特性:采用剥离,数据将在几个磁盘上进行分割。数据被分成很多数...

2019-03-05 19:58:01 9616

原创 【leetcode】28. Implement strStr()

28. Implement strStrProblemSolution1、C (一般解法)2、 C (KMP)ProblemImplement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example...

2019-03-02 11:48:50 144

转载 mdadm软RAID的删除方法和注意事项

删除整个raidmdadm /dev/md0 --fail /dev/sdb --remove/dev/sdbmdadm /dev/md0 --fail /dev/sdc --remove/dev/sdcmdadm /dev/md0 --fail /dev/sdc --remove/dev/sddmdadm /dev/md0 --fail /dev/sde --remove/dev/sde...

2019-03-01 17:38:19 2408

原创 【leetcode】11. Container With Most Water

11. Container With Most WaterProblemSolution1、C 8 ms, faster than 65.90% 8 MB, less than 44.59%ProblemGiven n non-negative integers a1, a2, …, an , where each represents a point at coordi...

2019-02-26 15:08:41 160

原创 【面试题】用两个栈实现一个队列

用两个栈实现一个队列ProblemSolutionProblem用两个栈实现一个队列Solution#include <stack>#include <iostream>using namespace std;void stackToQueue(stack<int> &s){ stack<int> news; ...

2019-02-26 10:03:49 149

原创 【面试题】:一个栈实现另一个栈的排序

只用一个栈实现另一个栈的排序ProblemSolutionProblem要求:只用一个栈,实现另一个栈的排序,除了变量之外不可用任何类型数据结构Solution#include <iostream>#include <stack>using namespace std;void sortStack(stack<int> &am

2019-02-25 19:49:19 208

原创 udev规则编写

udev 规则编写参考链接:udev规则编写

2019-02-22 14:00:19 1981

原创 #define 和 do{...}while(0) 的妙用

@[TOC](#define 和 do{…}while(0) 的妙用)最近在阅读公司代码的时候发现宏定义 #define 后面的语句都是被 do{…}while(0); 圈起来的。作为一个还没毕业的实习生,对此很是不解。正确认识宏定义#define#define是在预处理的时候进行直接替换这个是重点!举例:#define func(x) x*10-2int res = 4*func(...

2019-01-29 11:05:04 5517 4

原创 【leetcode】25. Reverse Nodes in k-Group

25. Reverse Nodes in k-GroupProblemSolution1、Python 递归 (36 ms, faster than 99.50%)ProblemGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a p...

2019-01-23 17:55:01 96

原创 链表交换节点

链表交换节点单链表交换节点代码单链表交换节点代码

2019-01-23 17:51:03 3354 2

原创 面试常用查找算法

面试常用查找算法代码代码方面适应所有算法,都使用有序数组#include <stdio.h>#include <stdlib.h>// sequence searchint SequenceSearch(int* a, int value, int length) { int i; for (i = 0; i < length; i++)...

2019-01-22 20:23:32 973

原创 面试常用排序算法

面试常用手撸排序算法代码代码#include <stdio.h>#include <stdlib.h>#include <string.h>// Bubble sort (O(n^2))void BubbleSort(int* a, int len) { int i, j, temp;

2019-01-22 17:06:57 380

原创 【leetcode】23. Merge k Sorted Lists

23. Merge k Sorted ListsProblemSolution1、Python (124 ms, faster than 61.75% )ProblemMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:...

2019-01-17 20:26:22 81

原创 【leetcode】148. Sort List

148. Sort ListProblemSolution1、Python (320 ms , faster than 68.55%)ProblemSort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2...

2019-01-17 17:16:53 127

原创 【leetcode】88. Merge Sorted Array

88. Merge Sorted ArrayProblemSolution1、Python (36 ms)2、CProblemGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized i...

2019-01-15 19:59:57 83

原创 linux内核常见函数

Linux内核常见函数SYSCALL_DEFINE1(name, )unlikely/likelySYSCALL_DEFINE1(name, )1/2/3/4/5/6unlikely/likely

2019-01-14 14:02:53 3520 1

原创 linux内核库aio

linux内核库aio调研背景介绍两种头文件:5 个系统调用:(man手册)echo > /proc/sys/fs/aio-max-nr 1048576背景介绍图 1. 基本 Linux I/O 模型的简单矩阵两种头文件:原生的AIO_ABI方法 /usr/include/linux/aio_abi.h /usr/include/aio.h通过无名信号量signal机制来...

2019-01-12 14:14:25 2919

原创 每天一问:How the default value of /proc/sys/fs/aio_max_nr is determined

How the default value of /proc/sys/fs/aio_max_nr is determined 引申引申include all arguments in /proc/sys/fs/

2019-01-11 10:40:00 410

原创 CentOS 7不收集日志 /var/log/messages

CentOS 7不收集日志 /var/log/message背景Solution前一直有日志生成,正常运行,日志突然不收集 ,最后一次轮替日志之后,/var/log/message, /var/log/secure等都不记录了,并且都是空文件。背景重启机器:reboot 无效重启日志: systemctl start rsyslog 无效怀疑空间不足,删除/...

2019-01-10 11:22:56 11766 2

原创 存储一问:文件系统——卷和快照小BUG

存储小疑惑背景原因方法对于一个文件系统,比如 zfs,ext4等背景当我们创建一个卷,把它映射出来,格式化成ext4文件系统 挂载到客户机后,对这个卷多次读写,并在每次读写后做快照,如果这个卷一致没有被 umount 掉,做出来快照后,从快照中读出来得信息可能会使被破坏的信息。原因因为当数据被写入卷中后,可能并未实现真正的数据落盘,有一部分数据会残留在内存中,比如文件系统或者别的缓冲区中...

2019-01-09 18:06:02 321

原创 【leetcode】21. Merge Two Sorted Lists

21. Merge Two Sorted ListsProblemSolution1、python (72ms)ProblemMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two ...

2019-01-08 20:16:07 117

原创 【leetcode】4. Median of Two Sorted Arrays

4. Median of Two Sorted ArraysProblemSolution1、python (108ms)ProblemThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall ru...

2019-01-04 10:43:51 87

原创 【leetcode】18. 4Sum

18. 4SumProblemSolution (1240 ms)ProblemGiven an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruple...

2018-12-27 19:16:24 86

原创 dd 对裸盘读写时 seek 和 skip 命令 【linux】

dd的seek和skip用法写入磁盘读出磁盘md5sum 校验写入磁盘if=/root/test/4096-1024-lsfs of=/dev/sdh bs=4096 seek=0 count=1024if=/dev/sdh of=/root/test/4096-2560-lsfs bs=4096 skip=1024 count=2560读出磁盘dd if=/dev/sdj of=/ro...

2018-12-27 13:54:34 4285

原创 【leetcode】15. 3Sum

15. 3SumProblemSolution1. pythonProblemGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zer...

2018-12-24 20:37:35 93

原创 malloc后free出错 (释放了错误的地址空间)

malloc后free出错

2018-12-20 16:46:40 1677

原创 【leetcode】13. Roman to Integer

13. Roman to IntegerProblemSolutionProblemRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L ...

2018-12-19 20:04:31 107

原创 【leetcode】14. Longest Common Prefix

14. Longest Common PrefixProblemsolutionProblemWrite a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string “”.Example...

2018-12-19 19:57:36 105

原创 zfs文件系统应用总结

zfs文件系统遇到的问题

2018-11-16 19:33:45 2519

原创 一个很有用的小工具 rsync

一个很有用的运维小工具 rsync

2018-11-16 19:30:16 120

原创 网络socket编程【linux/C】

知识点总结:1、int socket(int family,int type,int protocol)family:指定使用的协议簇:AF_INET(IPv4) AF_INET6(IPv6) AF_LOCAL(UNIX协议) AF_ROUTE(路由套接字) AF_KEY(秘钥套接字)type:指定使用的套接字的类型:SOCK_STREAM(字节流套接字) SOCK_DGRAMprot...

2018-11-12 19:23:43 185

原创 C语言中 main 函数的参数 argc&argv

argc、argv用命令行编译时有用argc:整数srgv:二维数组、指针的指针、指针数组例子#include<stdio.h>#include<stdlib.h>int main(int argc, char** argv) { int i, n; printf("There are %d arguments:\n", argc - 1);...

2018-11-12 11:33:12 310

原创 C语言库函数的漏洞总结【笔记】

C语言库函数漏洞memeset函数strcpy函数memeset函数strcpy函数

2018-11-06 16:42:55 1390

原创 C语言指针【笔记】

C语言指针【笔记】指针变量定义指针变量指针变量: 本身也是一个变量,用来存储在内存中的地址。普通变量: 本身也是一个变量,用来存储数据本身的值。定义因为C语言是一种相对自由形式的语言,相信你在一些指针代码中可以看到下面两种定义,其实他们是等价的。第二种定义是不是看起来更舒服,更能理解指针的含义呢。其实可以看成一个指针变量pb,他的指针类型是int*。int *pb;等价于int*...

2018-11-06 11:53:15 1670

zfs快照克隆删除

读取一个 volume 块设备里面的东西,这个 volume 是通过 iscsi 映射给客户端进行不间断的写操作,怎样在不停止写操作的前提下读取某一时刻这个 volume 里面的数据信息。

2018-11-16

网络socket编程【linux/C】

一个简单的socket编程,保证可以运行的网络socket编程实例,供大家学习案例。有问题咨询我。请在同一台机器上运行~

2018-11-12

微软C编程精粹

介绍了许多编程技巧,堪称C语言灵魂之书。值得广大程序员学习。

2018-11-07

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除