自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 Understand of WOE and IV in feature engineering

Introduction of WOEWOE(weight of evidences) tells the power of an idependent variable in relation to the dependent variable.Formulafor each group i:WOE = ln(% of non-events / % of events)Steps of Calculating WOEFor a continuous variable, split data

2021-07-17 18:02:27 120

原创 [leetcode-3] Longest Substring Without Repeating Characters

DescribtionGiven a string s, find the length of the longest substring without repeating characters.Solutionuse the start variable to denote the head of substringuse the dp array to store the length of the substring, need to handle the empty stringsta

2020-10-25 16:20:30 82

原创 [leetcode-763] Partition Labels

DescriptionA string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing the size of these parts.SolutionSel

2020-09-12 16:33:31 113

原创 [leetcode-78]Subsets

DescriptionGiven a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2],

2020-08-16 22:52:51 77

原创 通过fusion在ubuntu和宿主机之间共享目录

通过fusion的界面添加共享目录在客户机中通过vmware-hgfsclient查看可用共享目录通过vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other把宿主机共享目录挂载到客户机的/mnt/hgfs最后通过软连接把共享目录链接到目标路径...

2020-08-09 14:17:54 196

原创 内存模型简介

概述由于在现代计算的体系结构上,CPU的执行速度远远快于内存的访问速度,因此引入了诸如cache、分支预测、指令预取等技术以提高CPU的利用率。在多线程的编程环境下,这可能会带来一些问题,因此了解并掌握内存模型有助于我们在面对这些问题是有较为清晰的思路。内存模型的定义内存模型:描述多线程编程环境下,线程对内存的访问顺序内存模型的定义应包含以下三个方面:Atomic OperationsParital order of operationsVisable effects of operatio

2020-06-13 17:14:55 765

原创 fork与namespace

fork的使用fork用于创建子进程,而exec可以替换子进程执行的代码。一个简单的例子:#include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <sys/wait.h> int main(){ pid_t pid; int r

2020-05-24 19:03:20 421

原创 [leetcode-287] Find the Duplicate Number

Problem DescribtionGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.Example 1:Inp

2020-05-16 17:10:19 127

原创 [leetcode-448]Find All Numbers Disappeared in an Array

Problem DescriptionGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Could you do it without extra space and in

2020-05-10 14:43:31 113

原创 [leetcode-121] Best Time to Buy and Sell Stock

Problem DescriptionSay you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one s...

2020-05-06 10:02:18 83

原创 Difference of docker volume types

Share Dir between container and hostTo Mount files/dir from container to host, it need a named volume. Named volume is bind to a path of the host. If the path doesnt’s contain any files, copy from co...

2020-04-30 00:00:02 108

原创 如何判断一个结构体的实际占用空间

背景cpu读取内存是以2的整数次幂为单位读取(一次读取一块内存,如一次读入4个字节),如果不进行对齐,那么本来只需要一次进行的访问,可能需要好几次才能完成,并且还要进行额外的merger或者数据分离。方法先确定实际对齐单位,其由以下三个因素决定结构体最大成员(基本数据类型变量)预编译指令#pragma pack(n)手动设置 n–只能填1、2、4、8、16CPU...

2020-04-23 20:38:11 303

原创 Redis的Hash Table实现总结

Hash Table的数据结构从下到上可划分为:// 存储键值对的地址typedef struct dictEntry { void *key; union { void *val; uint64_t u64; int64_t s64; double d; } v; struct dictEntry...

2020-04-16 11:09:04 400

原创 用户线程与内核线程

空间类型用户空间用于执行用户代码, 如计算,循环等非I/O相关代码。内核空间用于执行系统级的代码,如调度线程、处理I/O等。可通过时间片耗尽中断(以及其他类型的中断)或用户空间的程序主动调用systemcall进行空间之间的切换。线程一般进程由若干个线程组成,而所有的线程组成了进程的流程。线程拥有自己的PC、寄存器以及栈,但是进程中的所有线程共享了同一个代码和数据片段,以及打开的文件。...

2020-04-09 23:38:49 424

原创 C++中的声明与定义

综述在c++中声明与定义是如此相似却又不尽相同。以至于在很多地方会把声明与定义混淆。有关声明与定义的讨论总是离不开翻译单元,每个翻译单元都可有编译器独立编译,因而翻译单元必定包含了它所需要用到的所有变量和函数描述符。对翻译单元而言,若描述符有完整的实现,则称其为定义了该描述符,否则称之为声明了该描述符。异同在程序中,声明可以发生多次但定义只能有一次。编译器不会为声明分配内存(确定内存大小...

2020-04-06 11:18:11 186

原创 top工具使用简介

简介top工具用于查看操作系统中的进程和资源使用情况,此外还可以进行如浏览、终止进程等交互操作。常用指标进程状态Runnable ®: 进程正在运行或者处于等待CPU分配的状态(就绪)。Interruptible sleep (S): 处于睡眠中状态中的进程(可调度的用户进程)。Uninterruptible sleep (D): 因等待I/O而处于睡眠中的进程(不可调度的用户进程)...

2020-04-02 14:45:57 1107

原创 C++虚函数表的使用

虚函数表的意义虚函数表是用于实现动态绑定的一种机制。动态绑定动态绑定用于确定该调用的函数,用于支持多态,如:#include <iostream>class B{public: virtual void bar(); virtual void qux();};void B::bar(){ std::cout << "This is B's...

2020-03-31 23:55:21 99

空空如也

空空如也

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

TA关注的人

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