• Chapter 6 - The Segment Tree

    定义 注意 补充、解释 其他 1 MotivationGiven an array A[1000000], and we need to frequently calculate the sum of the numbers in an arbitrary range [L, R].如果每次都从L算到R,时间复杂度都是,如果计算频繁,就比较慢 利用线段树,我们可以做到查询某个区间的和以及更...
  • Chapter 5 - Union-Find

    定义 注意 补充、解释 其他 1 Intro并查集(Union-Find)是一种树型的数据结构,用于处理一些不相交集合的合并及查询问题。它常用于判断两个元素是否属于同一个集合,并在需要时将两个集合合并。并查集在处理动态连通性问题时非常有效。 2 The Dynamic Equivalence ProblemExampleGiven S = { 1, 2, 3, 4, 5, 6, 7, 8,...
  • Chapter 4 - Heap

    定义 注意 补充、解释 其他 1 Heap (Priority Queue)优先队列:出队不是先进的出,而是有优先级这里我们讨论的优先级为最大/最小,即出队时最大/最小的元素先出队,那么有用数组/链表实现时,出队就要先查找最小/最大元素如果使用BST,我们将面临一个问题:每次删除最小/最大元素时都只会动最左边/最右边的结点,或插入新元素,慢慢的这棵树就偏了。而堆的核心操作就是「频繁删除堆顶...
  • Chapter 2 - Basic Structures

    定义 注意 补充、解释 其他 1 Sets1.1 DefinitionDefinitionA set is an unordered collection of objects. The objects in a set are called the elements of the set. 在这门课中,集合的元素可以重复 Subset (A is a subset of B.)is a t...
  • Lecture 01 Shell

    使用Windows的同学请先安装WSL或Linux虚拟机 Argument Parsing参数间以空格分隔,第一个参数是命令,例如 1234❯ echo hello worldhello world❯ echo "hello world"hello world cd: 切换当前目录 1234❯ cd ~❯ cd Fuyukawa/../...
  • Chapter 3 - Tree

    定义 注意 补充、解释 其他 0  Solution to Exercise1  PreliminariesDefinitionA tree is a collection of nodes.The collection can be empty;otherwise, a tree consists of a root 0 or more nonempty subtrees 一棵树有n个...
  • FDS-Exercise

    0 写在前面第一次quiz有点依托,这里总结一下各种练习题 #1 逆转链表Problem12345678typedef struct Node *PtrToNode;typedef PtrToNode List;typedef PtrToNode Position;struct Node { ElementType Element; Position Next; ...
  • Chapter 2 - Combinational Logic Circuits

    1 Binary Logic and Gates1.1 Binary Variables取值0或1的变量 1.2 Logical OperationsAND()OR(+)NOT() Examples:Y=A × B is read”Y is equal to A AND B.” 详细内容可以看离散数学的笔记 1.3 Logic GatesIn the earliest computers,s...
  • Chapter 2 - Lists,Stacks,Queues

    定义 注意 补充、解释 其他 0  Solution to Exercise1  Abstract Data Type(ADT)DefinitionData Type = {Obejcts}{Operations}An ADT is a data type that is orgnized in such a way that the specification(说明) on the obj...
  • Chapter 1 - Logic and Proofs

    写在前面离散数学的笔记对翁老师分享的前辈的笔记有所参考,所以放在前面,文章中讲的不详细的地方,大家可以去阅读学长的笔记 定义 注意 补充、解释 其他 术语对照参考这就来了( conjunction 合取 disconjunction 析取 exclusive or 异或 precedence 优先级 1 Propositional Logic1.1 PropositionDefi...
1234