0%

进程内存布局

32 位保护模式下 Linux 中进程的内存布局如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

0xFFFFFFFF ------> +----------------------+ <--+
| | |
| OS Kernel | | 1GB
| | |
0xC0000000 ------> +----------------------+ <--+
| | | |
| | stack | |
v | | |
+----------------------+ |
| | |
+----------------------+ |
| Memory Mapping Region| |
0x40000000 ------> +----------------------+ |
| | |
+----------------------+ |
^ | | |
| | heap | | 3GB
| | | |
+----------------------+ |
| Read/Write Segments | |
| .bss | |
| .data | |
+----------------------+ |
| Read-only Segments | |
| .init .text .rodata | |
| | |
0x08048000 ------> +----------------------+ |
| reserved | |
0x00000000 ------> +----------------------+ <--+
阅读全文 »

线性回归

线性模型

数据集:$D = \{(\boldsymbol{x}_1, y_1), (\boldsymbol{x}_2, y_2), … , (\boldsymbol{x}_m, y_m)\}$,$\boldsymbol{x}_i = (x_{i1}; x_{i2};…; x_{id})$

损失函数 (Loss function) 采用平方损失:

目标是找到一组解 $(\boldsymbol{w}^{\star}, b^{\star})$ 使得损失函数的值最小,即:

阅读全文 »

bitset 一般代替 bool 数组使用,常用于优化空间,因为 bitset 中一个元素只占 1 bit。

阅读全文 »

题目链接:1121 Damn Single (25 分)

“Damn Single (单身狗)” is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.

阅读全文 »

题目链接:HDU 1269

Problem Description

为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是否任意两个房间都是相互连通的,即:对于任意的i和j,至少存在一条路径可以从房间i到房间j,也存在一条路径可以从房间j到房间i。

阅读全文 »

题目链接:1154 Vertex Coloring

A proper vertex coloring is a labeling of the graph’s vertices with colors such that no two vertices sharing the same edge have the same color. A coloring using at most $k$ colors is called a (proper) $k$-coloring.

Now you are supposed to tell if a given coloring is a proper $k$-coloring.

阅读全文 »