数据结构与算法
0.0 PTA实录
0.1.1 最大子列和plus
- 如何利用语句先后顺序记录上一条信息
pre_start_tag
void sum_max_sequence(void) |
Regular Expression 正则表达式
基本知识
特殊字符
*
:匹配前面的字符0+次
+
:匹配前面的字符1+次
?
:匹配前面的字符0/1次
[a-z_]
:匹配中括号内字符1次,示例是匹配小写字母或下划线
定位符
^
:表示开头处
$
:表示结尾处
\b
:匹配单词间的空格处
特殊序列
\d
:匹配数字
\w
:匹配字母、数字、下划线
\s
:匹配不可见字符
\D
:匹配非数字
\W
:匹配非字母、数字、下划线
\S
:匹配非空白字符
举例
- “hel?o”:可以匹配heo, helo(0次或1次)
- “hel+o”:可以匹配helo, hello(1次以上)
- “hel*o”:可以匹配heo, helo, hello(0次以上)
- r"+\-*/":匹配加减乘除符号,r表示不转义
Deep Reading
“When in doubt go to the library.” – J.K.Rowling
Catalog
Article1: What Are You Going to Do With That?
What Are You Going to Do With That?
William Deresiewicz(《国家》杂志撰稿人和《新共和》杂志编辑)在斯坦福大学的演讲
The question my title poses, of course, is the one that is classically aimed at humanities majors. What practical value could there possibly be in studying literature or art or philosophy? So you must be wondering why I’m bothering to raise it here, at Stanford, this renowned citadel of science and technology. What doubt can there be that the world will offer you many opportunities to use your degree?
(学习文学、艺术或哲学能有什么用呢?所以你肯定纳闷,我为什么在在以科技堡垒而闻名的斯坦福提出这个问题呢?在大学学位给人带来众多机会的问题上还有什么可怀疑的吗?)
But that’s not the question I’m asking. By “do” I don’t mean a job, and by “that” I don’t mean your major. We are more than our jobs, and education is more than a major. Education is more than college, more even than the totality of your formal schooling, from kindergarten through graduate school. By “What are you going to do,” I mean, what kind of life are you going to lead? And by “that,” I mean everything in your training, formal and informal, that has brought you to be sitting here today, and everything you’re going to be doing for the rest of the time that you’re in school.
(但那不是我提出的问题。这里的“做”并不是指工作,“那”并不是指你的专业。我们不仅仅是要个工作,教育不仅仅是学一门专业。教育也不仅仅是上大学,甚至也不仅是从幼儿园到研究生院的正规学校教育。我说的“你要做什么”的意思是你要过什么样的生活?我所说的“那”指的是你得到的正规或非正规的任何训练, 那些把你送到这里来的东西,你在学校的剩余时间里将要做的任何事。)
Read Origin
技术博主
- 多看开发者大会!
- ThePrimeTime
- CodeAesthetic
- Molly Rocket
What’s so special about 2147483648?
by Sandra Henry-Stocker, Unix Dweeb, from NetWorkWorld 945870
tags: Data Center, Linux, Open Source
难度:EASY
First of all, it’s a power of 2. That’s undoubtedly not the most obvious thing unless you’re some kind of mathematical genius. And, to be exact, it’s 2^31. That’s significant — as you’ll see in a minute.
In binary, 2147483647 is 01111111111111111111111111111111 and it’s the biggest positive number that will fit in 32 bits when using the “two’s complement” notation (补码) — the way of representing numbers that allows for negative values. If we could use that leftmost (high order) bit, the largest possible number would be twice as large since every extra bit doubles the range of numbers that a binary number can represent.
And 2147483648 just happens to be the number you’d get if you multiplied 256 * 256 * 256 * 256 and then divided the result by 2. Not excited yet? Give me a moment.
Makefile使用
标准写法
- 编译
hello.c
hello:hello.c |
- 更有效率的写法
CC=gcc |
- 全部编译
SOURCE = $(wildcard *.c) |
Makefile文件的格式
[廖雪峰](http://ruanyifeng.com/blog/2015/02/make.html)
Makefile文件由一系列规则(rules)构成。每条规则的形式如下。
<target>: <prerequisites> |
上面第一行冒号前面的部分,叫做"目标"(target),冒号后面的部分叫做"前置条件"(prerequisites);第二行必须由一个tab键起首,后面跟着"命令"(commands)。
- 键入
make -nB
, 它会让make
程序以"只输出命令但不执行"的方式强制构建目标。
文件名匹配
%.o: %.c # 所有.o/.c结尾的文件 |
变量
txt = Hello World |
PHP ADTP后台管理
ICS 计算机系统
第一阶段 程序的表示、转换与链接
参考MOOC:NJU-1001625001
1.0 计算机系统概述
1.3 程序开发和执行过程
- hello.c程序用ascii文本表示
- 首先.c文件预处理为.i文件(把预处理指令翻译过来),然后.i文件编译成.s文件(汇编程序文本),接着.s文件汇编成.o文件(二进制),与printf等函数的.o文件共同连接成可执行文件(二进制)
- 高级语言编写程序所需环境:(1)语言处理程序; (2)语言处理系统; (3)语言运行时的系统; (4)操作系统内核; (5)操作系统; (6)指令集体系结构; (7)人机接口
1.4 计算机系统层次结构
- 过程式语言:如何做; 非过程化语言:做什么;语言发展是不断抽象的过程
- 应用->算法->语言->操作系统->(软件)ISA指令集(硬件)->微体系、功能部件、电路和器件
非预期结果是硬件层次造成的。上层是下层的抽象,下层是上层的实现,底层为上层提供支撑环境 - 题目:由机器语言编程的早期计算机系统中,没有ISA这一层次(F);一直都有ISA,因此ISA是计算机体系层次中最重要的层次。
ISA, Instruction Set Architecture(结构)规定了如何使用硬件,是可以执行的指令的集合,包括指令格式、操作种类及操作数的类型的规定…
没有ISA,软件无法使用计算机硬件,一台计算机就不能成为“通用”计算机 - 计算机组成必须能够实现ISA规定的功能;同一种ISA可以由不同的计算机(硬件)组成,如乘法指令用ALU或乘法器都可以实现
- 题目:有没有乘法指令是ISA考虑的问题,如何实现乘法指令是微体系结构考虑的问题
1.5 计算机系统基础学习目标
- 编写高效程序必须了解计算机底层结构
- 必须掌握并行程序设计技术和工具
- 课程目标:理解计算机如何生成和运行可执行文件
- 涉及层次:C语言设计层,ISA和汇编层,微体系结构和硬件层
- 第一部分 程序表示与转换;第二部分 执行控制流
PyEcharts 数据可视化
1.0 Bar 柱状图
from pyecharts.charts import Bar |
- 效果