- 博客(359)
- 收藏
- 关注
原创 Unit 4: 语法分析 LL(1)文法
S --推导–> 词串β 的过程中,要考虑:替换哪个VN用哪个候选式替换引子:最左推导(Left-most Derivation):每次选择最左非终结符替换最右规约:最右推导(Right-most Derivation):最左规约???递归下降分析(Recursive Descent Parsing)回溯(Backtracking):存在歧义时(匹配到多个产...
2020-05-02 16:06:02
401
原创 Hash 散列
Hash散列函数的设计Key 是 整型Key 是 字符串冲突处理方法开放地址法(Open Address)再散列链地址法(Separate Chaining)散列表性能分析 ASL成功平均查找长度(ASLs)失败平均查找长度(ASLu)解决动态查找问题,字符串管理:-如:编译器中变量名的管理(插入,查找)将字符串 --> 数值 : 进行数值比较散列函数的设计Key 是 整型...
2020-05-01 14:18:40
469
原创 网络编程初识(Socket编程)
TCP = {Socket 1: Socket 2} = {{IP:Port} {IP:Port}}C/ S 架构:Server 端# _*_ encoding=utf-8 _*_import socketdef server(): # 创建socket s = socket.socket() host = '127.0.0.1' port = 66...
2020-04-30 10:35:36
177
原创 ECMAScript 快速入门
引子弱类型:不显示声明变量类型,对同一变量最好使用时不改变其初始类型变量var a = 1, b = ")"原始类型原始值 & 引用值原始值:一般“就地”存放在栈上引用值:是一个指针,指向存储在堆中的对象变量存在栈上,会提高变量查找和访问的速度ECMAScript定义了5种原始类型:Undefined, NULL, Boolean, Number, String运算...
2020-04-29 23:25:56
203
原创 QML 快速入门
QML顶层窗口:QML 基本元素Rectangle:Item锚布局 anchors响应按键TextButton (常用!)ButtonStyleImage:FileDialog实例1: 从网络加载图片实例2: 图片浏览器顶层窗口:所有qml元素活动的舞台可以通过Window,或QQuickView创建QML 基本元素Rectangle: Rectangle { i...
2020-04-29 21:18:49
718
原创 数据库 之 概念模型-ER图
抽象 -> 区分 -> 命名 -> 表达ER模型 (Entity-Relation)理论实体集:域:属性允许取值的集合属性种类:简单属性 & 复合属性单值属性 & 多值属性派生属性联系集用来表示实体集之间的联系度参与联系的实体集数量:一元联系,二元联系…任何非二元联系都可以转换为二元联系:人为的创建实体集(将多元联系按实体...
2020-04-28 17:49:50
5669
原创 Unit 3 词法分析: 从正则表达式到有穷自动机
引言:正则表达式有两种基本要素——字符表达式和ε表达式,以及三种基本运算——并、连接和闭包有穷自动机 (FA: Finite Automata)正则表达式并不能直接用来解析字符串,所以引入有穷自动机这种适合转化为计算机程序的模型FA的表示: 转换图、转换表转换图:结点表示状态,只有一个初始状态,若干终止状态(双圈表示)边表示条件转移:遇到输入x则转移最长匹配原则(Lo...
2020-04-28 16:13:07
372
原创 Unit 2 文法分类
文法分类文法的形式化定义文法分类:Chomsky0型文法 (Unrestricted Grammer / Phrase Structure Grammer)1型文法 (Context-Sensitive Grammer)2型文法 (CFG:Context-Free Grammer)3型文法(RG: Regular Grammer)文法关系:分析树文法的形式化定义G = (VT, VN, P, ...
2020-04-28 15:28:16
589
原创 python实现支持异步的线程池
Py3: ThreadPoolExecutorPython 的同步原语互斥锁lock = threading.Lock() #申请锁lock.acquire()lock.release()条件变量 (信号量)condition = threading.Condition()condition.acquire() #加锁condition.release() #解锁cond...
2020-04-26 21:26:58
1026
原创 Application Layer
8-1 Application Layer OverviewUsing UDP: real-time conference,Using TCP: series of variable length, reliable request, reply exchangesOld OSI reference Model:->Session : is a series of related n...
2020-04-25 11:10:18
185
原创 CSS入门
01 Ready?1-1 内联1-1-1 内联CSS内联样式,将CSS用于单个元素<p style="color:white; background-color:gray;"> Hello world.</p>1-1-2 内部样式表 <head> <style> p { col...
2020-04-24 18:26:13
175
1
原创 CSS3
#1. CSS3是啥啊啊啊?新功能:Border radius - 允许我们为元素创建圆角。Border images - 允许我们指定一个图像作为元素周围的边框。Multiple backgrounds - 将多个背景应用于元素。动画(Animations)和特效(effects)…为了使Web开发更加简单快捷,CSS3引入了更多的新功能,其中包括:Box Shadow (盒阴...
2020-04-24 18:21:47
443
原创 Transport Layer
6-1 Transport Layer Overview–> Segments carry application data across the network.UnreliableReliableMessageDatagrams(UDP->connectionless)BytestreamStream(TCP->connection )...
2020-04-21 11:24:40
706
原创 Network Layer
Network Layer4-1 Network Layer Overview4-2 Network ServicesTwo Network Service Models4-3 InternetworkingIP Header4-4 IP Address & IP PrefixesIP Address Classes --> HistoricalPublic / Private IP...
2020-04-18 10:33:36
855
原创 Introduction Protocols and Laying
vocabulary:bandwidthtatistical multiplexing is just sharing bandwidth amongst users.binomial proabilitiesreplicas inside the networkscenarionetwork hopsehternet数字表示方法:2-30 = two to minus...
2020-04-15 08:36:53
160
原创 Link Layer
2-6 Link Layer: Framing MessagesMethods for framing:Byte count:(idex) length filed + framenext frame begin at: idex + lengthDifficult to re-synchronize after framing error…Byte stuffing (use ...
2020-04-14 10:27:21
455
原创 Physical Layer
2-5 Limit of physical layerThe Nyquist LimitShannon CapacityThe Nyquist Limitnoiseless channelThe maximum rate we send information across a noiseless channel is 2B multiplied by log to the b...
2020-04-14 10:26:46
198
原创 PAT A1063 Cartesian Tree (30分)
A Cartesian tree is a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the original sequence. For example, given the sequence { 8...
2020-04-12 17:38:18
126
原创 PAT A1162 7-3 Summit (25分)
A summit (峰会) is a meeting of heads of state or government. Arranging the rest areas for the summit is not a simple job. The ideal arrangement of one area is to invite those heads so that everyone is ...
2020-04-12 17:10:59
178
原创 PAT A1061 Block Reversing (25分)
Given a singly linked list L. Let us consider every K nodes as a block (if there are less than K nodes at the end of the list, the rest of the nodes are still considered as a block). Your job is to re...
2020-04-12 17:05:46
110
原创 PAT A1160 Good in C (20分)
When your interviewer asks you to write “Hello World” using C, can you do as the following figure shows?Input Specification:Each input file contains one test case. For each case, the first part giv...
2020-04-12 16:45:11
228
原创 MySQL 多实例配置
[root@localhost ~]# mkdir -p /data/330{7..9}/data[root@localhost ~]# cat > /data/3307/my.cnf <<EOF> [mysqld]> basedir=/app/database/mysql> datadir=/data/3307/data> socket=/tm...
2020-04-06 21:43:42
187
原创 MySQL 语法
DDL(Data Definition Language)DML(Data Manipulation Language)DCL(Data Control Language)基础语法:DDLCREATECreate tableCREATE TABLE FjjPractice.student (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT...
2020-04-06 21:38:22
745
原创 MySql 事务Transaction
事务 (transaction)的特性 ACIDAtomicityTransactions are atomic units of work that can be committed or rolled back.ConsistencyIsolation支持并发操作,事务间互不干扰MySQL:支持多事务并发工作的系统DurabilityCommit命令执行成功后,此次事务...
2020-04-06 21:37:36
245
原创 MySQL 索引Index
索引也是一张表,该表保存了主键与索引字段,并指向实体表的记录普通索引 普通索引是最基本的索引,它没有任何限制。创建索引CREATE INDEX indexName (indexName length) ON table_name;说明:如果是 CHAR、VARCHAR 类型,length 可以小于字段实际长度;如果是 BLOB、TEXT 类型,必须指定 length。添加索...
2020-04-06 21:36:40
207
原创 MySQL 视图View/Transparent
视图:Select语句的执行方法,不保存数据本身。执行方式:类似于C语言中:内联函数,将语句替换到对应位置使用方法:可以看作一个TABLEUSE world;CREATE VIEW v_select AS SELECT district, SUM(population)FROM cityWHERE countrycode = 'CHN'GROUP BY districtHAV...
2020-04-06 21:35:06
217
原创 MySQL 小知识
SHOW TABLES;SHOW COLUMNS FROM table_name;DROP TABLE table_name;添加字段ALTER TABLE table_name ADD field_name field_type;修改原字段名称及类型ALTER TABLE table_name CHANGE old_field_name new_field_name new_fi...
2020-04-06 21:32:46
210
原创 数据库:关系模型
行 row / 元组 tuple / 记录 record列 column / 字段 field / 属性 attribute / 数据项 dataitemDBMS(DataBase Management System)三个层次:External Level (User Level / View Level)局部:用户能看到的“部分”Conceptual Level (Logica...
2020-04-06 19:24:37
610
原创 关于Map的 坑
map<int, int> mp; 默认值为0访问某键值后,自动插入该pair当值减少到0时,pair还存在于map中针对2,3要手动erase元素#include <bits/stdc++.h>using namespace std;void Judge(map<int, int> & has){ if(has.find(1...
2020-04-05 22:14:35
194
原创 7-1 Conway's Conjecture (20分)
John Horton Conway, a British mathematician active in recreational mathematics, proposed a conjecture in 2014: arrange the factors of any given number in ascending order, and pull the exponents down, ...
2020-04-01 18:07:53
462
原创 7-2 Play with Linked List (25分)
Given a singly linked list L1→L2→⋯→Ln−1→Ln and an integer 1≤k<n, you are supposed to rearrange the links to obtain a list like Lk→Ln→Lk−1→Ln−1→⋯. For example, given L being ...
2020-04-01 17:57:14
2800
原创 7-3 Unsuccessful Searches (25分)
The above figure is a question from GRE-CS 2018. It states:Given an initially empty hash table HT of size 11. The hash function is H(key)=key%7, with linear probing used to resolve the collisions. N...
2020-04-01 17:48:09
896
原创 7-4 Ambulance Dispatch (30分)
Given the map of a city, with all the ambulance dispatch centers (救护车派遣中心) and all the pick-up spots marked. You are supposed to write a program to process the emergency calls. It is assumed that the ...
2020-04-01 17:45:43
2861
11
原创 CodeBlocks 16.01 使用方法
快捷键:更改快捷键方法:Setting -> Keyboard shortcuts:常用快捷键分类Edit:复制选中部分:Ctrl + D(复制整行、整块!!!)缩进当前行或选中块: Tab减少缩进: Shift+Tab/Line:Move Up : Alt + UP / Move Down: Alt + Down整行移动:好用!!!/Other:Insert n...
2020-03-18 19:13:45
708
原创 关键路径 Problem A: 关键路径
>>>>>>题目地址<<<<<<code:#include <bits/stdc++.h>using namespace std;const int maxn = 110;int inD[maxn];stack<int> reTopo;struct node{ int nex...
2020-03-14 22:22:56
135
原创 拓扑排序 Problem C: Legal or Not
>>>>>>题目地址<<<<<<思路:拓扑排序, 注意点:每次要更新inD#include <bits/stdc++.h>using namespace std;const int maxn = 110;vector<int> G[maxn];int inD[maxn];void T...
2020-03-14 19:17:58
134
原创 拓扑排序 Problem B: 确定比赛名次
>>>>>>题目地址<<<<<<code:#include <bits/stdc++.h>using namespace std;const int maxn = 1010;vector<int> G[maxn];int inD[maxn];bool TopologicalSort(...
2020-03-14 19:03:28
194
原创 拓扑排序 Problem A: 有向无环图的拓扑排序
>>>>>>题目地址<<<<<<code: 按题中要求用栈拓扑排序#include <bits/stdc++.h>using namespace std;const int maxn = 110;int G[maxn][maxn], inD[maxn];bool vis[maxn];void T...
2020-03-14 18:49:32
206
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅