open-courses
Search…
公开课笔记
CMU 15-445/645 Database Systems
Relational Data Model
Advanced SQL
Database Storage
Buffer Pools
Hash Tables
Tree Indexes
Index Concurrency Control
Query Processing
Sorting&Aggregations
Join Algorithms
Query Optimization
Parallel Execution
Embedded Database Logic
Concurrency Control Theory
Two Phase Locking
Timestamp Ordering Concurrency Control
Multi-Version Concurrency Control
Logging Schemes
Database Recovery
Introduction to Distributed Databases
Distributed OLTP Databases
Distributed OLAP Databases
UCB - CS162
OS intro
Introduction to the Process
Processes, Fork, I/O, Files
I/O Continued, Sockets, Networking
Concurrency: Processes & Threads
Cooperating Threads, Synchronization
Semaphores, Condition Variables, Readers/Writers
Scheduling
Resource Contention & Deadlock
Address Translation, Caching
File System (18,19,20)
Distributed Systems, Networking, TCP/IP, RPC (21,22)
Distributed Storage, Key-Value Stores, Security (23)
Security & Cloud Computing (24)
Topic: Ensuring Data Reaches Disk
MIT - 6.006
Sequence and Set Interface
Data Structure for Dynamic Sequence Interface
Computation Complexity
Algorithms and Computation
Structure Of Computation
Graph & Search
Tree & Search
Weighted Shortest Paths
String Matching, Karp-Rabin
Priority Queue Interface & Implementation
Dictionary Problem & Implementation
Sorting
Dynamic Programming
Backtracking
Self-Balancing Tree
MIT - 6.824
2PC & 3PC
Introduction and MapReduce
RPC and Threads
Primary/Backup Replication
Lab: Primary/Backup Key/Value Service
Google File System (GFS)
Raft
Lab: Raft - Leader Election
Lab: Raft - Log Replication
Stanford-CS107
原始数据类型及相互转化
指鹿为马
泛型函数
泛型栈
运行时内存结构
从 C 到汇编
函数的活动记录
C 与 C++ 代码生成
编译的预处理过程
编译的链接过程
函数的活动记录续、并发
从顺序到并发和并行
信号量与多线程 1
信号量与多线程 2
复杂多线程问题
函数式编程 - Scheme 1
函数式编程 - Scheme 2
函数式编程 - Scheme 3
函数式编程 - Scheme 4
函数式编程 - Scheme 5
Python 基础
MIT - 6.001 - SICP
什么是程序
程序抽象
替代模型
时间/空间复杂度
数据抽象
高阶函数
Symbol
数据驱动编程与防御式编程
数据抽象中的效率与可读性
数据修改
环境模型
面向对象-消息传递
面向对象 - Scheme 实现
构建 Scheme 解释器
Eval-Apply Loop
Normal Order (Lazy) Evaluation
通用机
寄存器机器
子程序、栈与递归
在寄存器机器中执行
内存管理
MIT - 6.046
Randomized Algorithms
Skip Lists
System Design
Twitter
Cache Consistency & Coherence
DDIA 笔记
Replication
Transactions
The Trouble with Distributed Systems
Consistency & Consensus
Papers We Love
Consistent Hashing and Random Trees (1997)
Dynamic Hash Tables (1988)
LFU Implementation With O(1) Complexity (2010)
Time, Clocks, and the Ordering of Events in a Distributed System (1978)
Dapper, a Large-Scale Distributed Systems Tracing Infrastructure (2010)
Gorilla: A Fast, Scalable, In-Memory Time Series Database (2015)
Release It 笔记
Anti-patterns & Patterns in Microservice Architecture
Database Design
Log Structured Merge (LSM) Tree & Usages in KV Stores
Prometheus
Powered By
GitBook
Algorithms and Computation
Computation
Computation 中有三个重要概念,问题(Problem)、算法(Algorithm) 和效率(Efficiency)。这三个概念将永远伴随你走过计算机生涯。
问题
一个合法的
问题
有以下几个特点:
问题定义了从输入到正确输出的二元关系
通常问题描述不会穷举所有输入到所有正确输出的关系,而是提供一个可验证的方式来确定输出是否正确。
通常问题的输入有两种,有界和无界。无界的输入可以有无限种输入。
算法
一个合法的
算法
有以下几个特点:
算法是一个将输入映射到确定输出的过程
”一个算法解决了一个问题“,意思是对于问题的任意输入,该算法都能将其映射到正确的输出
算法的大小必须是有限的
算法必须要能证明它的正确性:
有界输入问题:可以穷举
无界输入问题:必须通过归纳法证明
效率
Asymptotic Notation:
Upper Bounds:
O
O
O
Lower Bounds:
Ω
Ω
Ω
Tight Bounds:
θ
θ
θ
input
constant
logarithmic
linear
log-linear
quadratic
polynomial
exponential
n
θ
(
1
)
θ(1)
θ
(
1
)
θ
(
l
g
n
)
θ(lgn)
θ
(
l
g
n
)
θ
(
n
)
θ(n)
θ
(
n
)
θ
(
n
l
g
n
)
θ(nlgn)
θ
(
n
l
g
n
)
θ
(
n
2
)
θ(n^2)
θ
(
n
2
)
θ
(
n
c
)
θ(n^c)
θ
(
n
c
)
2
θ
(
n
c
)
2^{θ(n^c)}
2
θ
(
n
c
)
1000
1
≈
10
≈ 10
≈
10
1000
≈
10000
≈ 10000
≈
10000
1000000
...
2
1000
≈
1
0
301
2^{1000} ≈ 10^{301}
2
1000
≈
1
0
301
在谈论算法效率之前,必须明确我们的计算模型(Model of Computation)是什么:
Word-RAM
内存可以理解成可随机访问的数组,每个元素是一个字(32-bit 或者 64-bit),每次随机访问的时间复杂度为
O
(
1
)
O(1)
O
(
1
)
如何用算法解决一个问题
Reduce
将其转化成你所熟知的数据结构及算法,如:
Search Data Structures
Array
Sorted Array
Linked List
Dynamic Array
Binary Heap
Binary Search Tree / AVL
Direct-Access Array
Hash Table
Sort Algorithms
Insertion Sort
Selection Sort
Merge Sort
Heap Sort
AVL Sort
Counting Sort
Radix Sort
Shortest Path Algorithms
Breadth First Search
Depth First Search/Topo. Sort
Dijkstra
Bellman-Ford
Floyd-Warshall
Johnson
...
Design
设计你的递归/迭代算法:
将函数调用抽象成计算图中的一个点,A -> B 表示 A 调用 B
将算法按照计算图进行归类,见下表
证明算法的正确性
算法类别
计算图类别
访问节点数量
Brute Force
Star
All
Decrease & Conquer
Chain
All
Divide & Conquer
Tree
All
Dynamic Programming
DAG
All
Greedy / Incremental
DAG
Some
MIT - 6.006 - Previous
Computation Complexity
Next - MIT - 6.006
Structure Of Computation
Last modified
3yr ago
Copy link
Outline
Computation
问题
算法
效率
如何用算法解决一个问题
Reduce
Design