Standard graph representations, absolute value, triangle inequality.
parent
40e4b2207f
commit
020f33db8a
|
@ -197,7 +197,12 @@
|
||||||
"lcrs-nodes.png",
|
"lcrs-nodes.png",
|
||||||
"binary-tree-nodes.png",
|
"binary-tree-nodes.png",
|
||||||
"archimedean-property.png",
|
"archimedean-property.png",
|
||||||
"infinite-cartesian-product.png"
|
"infinite-cartesian-product.png",
|
||||||
|
"abs-value-geom.png",
|
||||||
|
"triangle-inequality.png",
|
||||||
|
"triangle-inequality-degenerate.png",
|
||||||
|
"adj-list-representation.png",
|
||||||
|
"adj-matrix-representation.png"
|
||||||
],
|
],
|
||||||
"File Hashes": {
|
"File Hashes": {
|
||||||
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
|
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
|
||||||
|
@ -380,7 +385,7 @@
|
||||||
"set/index.md": "91060cf5e604f7683a34710dda2ea10b",
|
"set/index.md": "91060cf5e604f7683a34710dda2ea10b",
|
||||||
"set/graphs.md": "15aa43bf7f73347219f822e4b400e9bf",
|
"set/graphs.md": "15aa43bf7f73347219f822e4b400e9bf",
|
||||||
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
|
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
|
||||||
"_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391",
|
"_journal/2024-03/2024-03-18.md": "2c711c50247a9880f7ed0d33b16e1101",
|
||||||
"awk/variables.md": "e40a20545358228319f789243d8b9f77",
|
"awk/variables.md": "e40a20545358228319f789243d8b9f77",
|
||||||
"awk/regexp.md": "4ce38103575a5321a1503b28e1d714dd",
|
"awk/regexp.md": "4ce38103575a5321a1503b28e1d714dd",
|
||||||
"awk/index.md": "257738d2d864933fb4bd21e8609c525d",
|
"awk/index.md": "257738d2d864933fb4bd21e8609c525d",
|
||||||
|
@ -398,7 +403,7 @@
|
||||||
"x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2",
|
"x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2",
|
||||||
"x86-64/instructions.md": "06b7fbe1a7a9568b80239310eb72e87a",
|
"x86-64/instructions.md": "06b7fbe1a7a9568b80239310eb72e87a",
|
||||||
"git/refs.md": "e20c2c9b14ba6c2bd235416017c5c474",
|
"git/refs.md": "e20c2c9b14ba6c2bd235416017c5c474",
|
||||||
"set/trees.md": "f5c6cd3bf1834b84fb0a55114a9c80f6",
|
"set/trees.md": "495fb5f29b20fbee9812cee2ea9e4504",
|
||||||
"_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6",
|
"_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6",
|
||||||
"_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b",
|
"_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b",
|
||||||
"_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9",
|
"_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9",
|
||||||
|
@ -503,7 +508,7 @@
|
||||||
"programming/pred-trans.md": "c02471c6c9728dd19f8df7bc180ef8b1",
|
"programming/pred-trans.md": "c02471c6c9728dd19f8df7bc180ef8b1",
|
||||||
"set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7",
|
"set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7",
|
||||||
"_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
"_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
||||||
"_journal/2024-05/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b",
|
"_journal/2024-05/2024-05-13.md": "d549dd75fb42b4280d4914781edb0113",
|
||||||
"x86-64/registers.md": "5cb49ae47fb0f95df6e15991274f4ad3",
|
"x86-64/registers.md": "5cb49ae47fb0f95df6e15991274f4ad3",
|
||||||
"_journal/2024-05-15.md": "4e6a7e6df32e93f0d8a56bc76613d908",
|
"_journal/2024-05-15.md": "4e6a7e6df32e93f0d8a56bc76613d908",
|
||||||
"_journal/2024-05/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
"_journal/2024-05/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
||||||
|
@ -766,7 +771,7 @@
|
||||||
"_journal/2024-08/2024-08-21.md": "1637b8ec8475cf3eb4f41d1d86cbf5df",
|
"_journal/2024-08/2024-08-21.md": "1637b8ec8475cf3eb4f41d1d86cbf5df",
|
||||||
"_journal/2024-08/2024-08-20.md": "e8bec308d1b29e411c6799ace7ef6571",
|
"_journal/2024-08/2024-08-20.md": "e8bec308d1b29e411c6799ace7ef6571",
|
||||||
"_journal/2024-08-23.md": "3b2feab2cc927e267263cb1e9c173d50",
|
"_journal/2024-08-23.md": "3b2feab2cc927e267263cb1e9c173d50",
|
||||||
"set/natural-numbers.md": "97ca466daf1173ed8973db1d1a1935cc",
|
"set/natural-numbers.md": "0646f917887830a8108bb8bcdfcff770",
|
||||||
"_journal/2024-08-24.md": "563fad24740e44734a87d7c3ec46cec4",
|
"_journal/2024-08-24.md": "563fad24740e44734a87d7c3ec46cec4",
|
||||||
"_journal/2024-08/2024-08-23.md": "7b5a40e83d8f07ff54cd9708017d029c",
|
"_journal/2024-08/2024-08-23.md": "7b5a40e83d8f07ff54cd9708017d029c",
|
||||||
"_journal/2024-08/2024-08-22.md": "050235d5dc772b542773743b57ce3afe",
|
"_journal/2024-08/2024-08-22.md": "050235d5dc772b542773743b57ce3afe",
|
||||||
|
@ -779,7 +784,10 @@
|
||||||
"c17/types/derived.md": "aff0d2b6d218fb67af3cc92ead924de3",
|
"c17/types/derived.md": "aff0d2b6d218fb67af3cc92ead924de3",
|
||||||
"c17/types/basic.md": "5064e21e683c0218890058882e06b6f3",
|
"c17/types/basic.md": "5064e21e683c0218890058882e06b6f3",
|
||||||
"c17/types/index.md": "b3e4f47b5f1f2a76d1d039e6263a41b8",
|
"c17/types/index.md": "b3e4f47b5f1f2a76d1d039e6263a41b8",
|
||||||
"_journal/2024-08-25.md": "316dcc41923e7c043bee51f434c90c85"
|
"_journal/2024-08-25.md": "e73a8edbd027d0f1a39289540eb512f2",
|
||||||
|
"_journal/2024-08/2024-08-24.md": "563fad24740e44734a87d7c3ec46cec4",
|
||||||
|
"algebra/abs-val.md": "a47bc08db62304eb526d15ede3e300cf",
|
||||||
|
"data-structures/graphs.md": "594d136ce637448641631c3647599c3a"
|
||||||
},
|
},
|
||||||
"fields_dict": {
|
"fields_dict": {
|
||||||
"Basic": [
|
"Basic": [
|
||||||
|
|
|
@ -11,6 +11,6 @@ title: "2024-03-18"
|
||||||
- [ ] Log Work Hours (Max 3 hours)
|
- [ ] Log Work Hours (Max 3 hours)
|
||||||
|
|
||||||
* Finished [buffer pool manager project](https://15445.courses.cs.cmu.edu/fall2022/project1/).
|
* Finished [buffer pool manager project](https://15445.courses.cs.cmu.edu/fall2022/project1/).
|
||||||
* Added notes on [[graphs|graph]]-related terminology. Updated "Introduction to Algorithms" to fourth edition.
|
* Added notes on [[set/graphs|graph]]-related terminology. Updated "Introduction to Algorithms" to fourth edition.
|
||||||
* Watched [How My Student Became 1 Dan](https://www.youtube.com/watch?v=ZvHL_lwfYYI&t=595s).
|
* Watched [How My Student Became 1 Dan](https://www.youtube.com/watch?v=ZvHL_lwfYYI&t=595s).
|
||||||
* Reviewed and commented on Gus's latest pass of soft skills course.
|
* Reviewed and commented on Gus's latest pass of soft skills course.
|
|
@ -8,7 +8,7 @@ title: "2024-05-13"
|
||||||
- [ ] Go (1 Life & Death Problem)
|
- [ ] Go (1 Life & Death Problem)
|
||||||
- [ ] Korean (Read 1 Story)
|
- [ ] Korean (Read 1 Story)
|
||||||
|
|
||||||
* Notes on [[graphs#Subgraphs|subgraphs]] and induced subgraphs.
|
* Notes on [[set/graphs#Subgraphs|subgraphs]] and induced subgraphs.
|
||||||
* Notes on [[remotes]].
|
* Notes on [[remotes]].
|
||||||
* Read through chapter 7 of "The Science of Programming", touching on the $wp$ predicate transformer.
|
* Read through chapter 7 of "The Science of Programming", touching on the $wp$ predicate transformer.
|
||||||
* Read chapter 1 of "Elements of Set Theory". Made some progress on chapter 2 which touches on the basic axiomatic foundations.
|
* Read chapter 1 of "Elements of Set Theory". Made some progress on chapter 2 which touches on the basic axiomatic foundations.
|
|
@ -7,3 +7,6 @@ title: "2024-08-25"
|
||||||
- [x] OGS
|
- [x] OGS
|
||||||
- [ ] Sheet Music (10 min.)
|
- [ ] Sheet Music (10 min.)
|
||||||
- [ ] Korean (Read 1 Story)
|
- [ ] Korean (Read 1 Story)
|
||||||
|
|
||||||
|
* Standard [[data-structures/graphs|graph]] representations.
|
||||||
|
* [[abs-val|Absolute value]] and the [[abs-val#Triangle Inequality|triangle inequality]].
|
|
@ -0,0 +1,160 @@
|
||||||
|
---
|
||||||
|
title: Absolute Value
|
||||||
|
TARGET DECK: Obsidian::STEM
|
||||||
|
FILE TAGS: algebra::abs
|
||||||
|
tags:
|
||||||
|
- algebra
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Let $x \in \mathbb{R}$. The **absolute value** of $x$, denoted $\lvert x \rvert$, is defined as $$\lvert x \rvert = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x \leq 0 \end{cases}$$
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the absolute value of $x \in \mathbb{R}$ denoted?
|
||||||
|
Back: $\lvert x \rvert$
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565708-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the absolute value of $x \in \mathbb{R}$ defined?
|
||||||
|
Back: $\lvert x \rvert = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x \leq 0 \end{cases}$
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565711-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
The absolute value of $x \in \mathbb{R}$ considers what two cases?
|
||||||
|
Back: Whether $x \geq 0$ or $x \leq 0$.
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565713-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x \in \mathbb{R}$. When is $-\lvert x \rvert \leq x < \lvert x \rvert$?
|
||||||
|
Back: When $x < 0$.
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565715-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x \in \mathbb{R}$. When is $-\lvert x \rvert < x \leq \lvert x \rvert$?
|
||||||
|
Back: When $x > 0$.
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565716-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x \in \mathbb{R}$. When is $-\lvert x \rvert \leq x \leq \lvert x \rvert$?
|
||||||
|
Back: Always.
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565717-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x, a \in \mathbb{R}$ and $a \geq 0$. How is $\lvert x \rvert \leq a$ equivalently written as a chain of inequalities?
|
||||||
|
Back: $-a \leq x \leq a$
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565718-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x, a \in \mathbb{R}$ and $a \geq 0$. How is $\lvert x \rvert \leq a$ geometricaly depicted?
|
||||||
|
Back:
|
||||||
|
![[abs-value-geom.png]]
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565719-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x, a \in \mathbb{R}$ and $a \geq 0$. How is $-a \leq x \leq a$ equivalently written using absolute value?
|
||||||
|
Back: $\lvert x \rvert \leq a$
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565720-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $x, a \in \mathbb{R}$ and $a \geq 0$. How is $-a \leq x \leq a$ geometrically depicted?
|
||||||
|
Back:
|
||||||
|
![[abs-value-geom.png]]
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565721-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Triangle Inequality
|
||||||
|
|
||||||
|
Let $x, y \in \mathbb{R}$. Then the **triangle inequality** of $\mathbb{R}$ states $$\lvert x + y \rvert \leq \lvert x \rvert + \lvert y \rvert$$
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does the triangle inequality of $\mathbb{R}$ state?
|
||||||
|
Back: For $x, y \in \mathbb{R}$, $\lvert x + y \rvert \leq \lvert x \rvert + \lvert y \rvert$.
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565722-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Why is the triangle inequality named the way it is?
|
||||||
|
Back: The length of a triangle side is $\leq$ the sum of the other two sides.
|
||||||
|
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
<!--ID: 1724609565723-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What algebraic inequality is demonstrated in the following?
|
||||||
|
![[triangle-inequality.png]]
|
||||||
|
Back: The triangle inequality of $\mathbb{R}$.
|
||||||
|
Reference: “Triangle Inequality.” In _Wikipedia_, July 1, 2024. [https://en.wikipedia.org/w/index.php?title=Triangle_inequality](https://en.wikipedia.org/w/index.php?title=Triangle_inequality&oldid=1232015318).
|
||||||
|
<!--ID: 1724609565724-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What degenerate triangle justifies use of $\leq$ over $<$ in the triangle inequality of $\mathbb{R}$?
|
||||||
|
Back:
|
||||||
|
![[triangle-inequality-degenerate.png]]
|
||||||
|
Reference: “Triangle Inequality.” In _Wikipedia_, July 1, 2024. [https://en.wikipedia.org/w/index.php?title=Triangle_inequality](https://en.wikipedia.org/w/index.php?title=Triangle_inequality&oldid=1232015318).
|
||||||
|
<!--ID: 1724609565725-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What two chains of inequalities can be added together to prove the triangle inequality of $\mathbb{R}$?
|
||||||
|
Back: $-\lvert x \rvert \leq x \leq \lvert x \rvert$ and $-\lvert y \rvert \leq y \leq \lvert y \rvert$.
|
||||||
|
Reference: “Triangle Inequality.” In _Wikipedia_, July 1, 2024. [https://en.wikipedia.org/w/index.php?title=Triangle_inequality](https://en.wikipedia.org/w/index.php?title=Triangle_inequality&oldid=1232015318).
|
||||||
|
<!--ID: 1724609565726-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does the general triangle inequality of $\mathbb{R}$ state?
|
||||||
|
Back: For real numbers $a_1, \ldots, a_n$, $$\left\lvert \sum_{k=1}^n a_k \right\rvert \leq \sum_{k=1}^n \lvert a_k \rvert$$
|
||||||
|
Reference: “Triangle Inequality.” In _Wikipedia_, July 1, 2024. [https://en.wikipedia.org/w/index.php?title=Triangle_inequality](https://en.wikipedia.org/w/index.php?title=Triangle_inequality&oldid=1232015318).
|
||||||
|
<!--ID: 1724611618744-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $a_1\, \ldots, a_n \in \mathbb{R}$. What is the following a generalization of? $$\left\lvert \sum_{k=1}^n a_k \right\rvert \leq \sum_{k=1}^n \lvert a_k \rvert$$
|
||||||
|
Back: The triangle inequality of $\mathbb{R}$.
|
||||||
|
Reference: “Triangle Inequality.” In _Wikipedia_, July 1, 2024. [https://en.wikipedia.org/w/index.php?title=Triangle_inequality](https://en.wikipedia.org/w/index.php?title=Triangle_inequality&oldid=1232015318).
|
||||||
|
<!--ID: 1724611618749-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Bibliography
|
||||||
|
|
||||||
|
* Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
|
||||||
|
* “Triangle Inequality.” In _Wikipedia_, July 1, 2024. [https://en.wikipedia.org/w/index.php?title=Triangle_inequality](https://en.wikipedia.org/w/index.php?title=Triangle_inequality&oldid=1232015318).
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
|
@ -0,0 +1,194 @@
|
||||||
|
---
|
||||||
|
title: Graphs
|
||||||
|
TARGET DECK: Obsidian::STEM
|
||||||
|
FILE TAGS: data_structure::graph
|
||||||
|
tags:
|
||||||
|
- data_structure
|
||||||
|
- graph
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
There are two standard ways of representing graphs in memory: **adjacency-list** representations and **adjacency-matrix** representations.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Using asymptotic notation, how do the number of edges in a graph relate to the number of vertices?
|
||||||
|
Back: $\lvert E \rvert = O(\lvert V^2 \rvert)$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579417-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
For graph $G = \langle V, E \rangle$, *why* is $\lvert E \rvert = O(\lvert V^2 \rvert)$?
|
||||||
|
Back: Because $E$ is a binary relation on $V$.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579420-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What are the two standard ways of representing graphs in memory?
|
||||||
|
Back: The adjacency-list and adjacency-matrix representation.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579422-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Which standard graph representation is preferred for sparse graphs?
|
||||||
|
Back: Adjacency-list representations.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579423-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Which standard graph representation is preferred for dense graphs?
|
||||||
|
Back: Adjacency-matrix representations.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579424-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
When is a graph $G = \langle V, E \rangle$ considered dense?
|
||||||
|
Back: When $\lvert E \rvert \approx \lvert V \rvert^2$.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579425-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Adjacency-List
|
||||||
|
|
||||||
|
Let $G = \langle V, E \rangle$ be a graph. An adjacency-list representation of $G$ has an array of size $\lvert V \rvert$. Given $v \in V$, the index corresponding to $v$ contains a linked list containing all adjacent vertices.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$ be a graph. It's adjacency-list representation is an array of what size?
|
||||||
|
Back: $\lvert V \rvert$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579426-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
The following is an example of what kind of graph representation?
|
||||||
|
![[adj-list-representation.png]]
|
||||||
|
Back: An adjacency-list representation.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579427-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Are adjacency-list representations used for directed or undirected graphs?
|
||||||
|
Back: Both.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579428-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$ be a graph. What is the sum of its adjacency-list representation's list lengths?
|
||||||
|
Back: N/A. This depends on whether $G$ is a directed or undirected graph.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579429-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$ be a digraph. What is the sum of its adjacency-list representation's list lengths?
|
||||||
|
Back: $\lvert E \rvert$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579431-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$ be an undirected graph. What is the sum of its adjacency-list representation's list lengths?
|
||||||
|
Back: $2\lvert E \rvert$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579432-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Which lemma explains the sum of an undirected graph adjacency-list representation's list lengths?
|
||||||
|
Back: The handshake lemma.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579433-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$. What is the memory usage of its adjacency-list representation?
|
||||||
|
Back: $\Theta(\lvert V \rvert + \lvert E \rvert)$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579434-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Adjacency-Matrix
|
||||||
|
|
||||||
|
Let $G = \langle V, E \rangle$ be a graph. An adjacency-matrix representation of $G$ is a $\lvert V \rvert \times \lvert V \rvert$ matrix $A = (a_{ij})$ such that $$a_{ij} = \begin{cases} 1 & \text{if } \langle i, j \rangle \in E \\ 0 & \text{otherwise} \end{cases}$$
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$ be a graph. It's adjacency-matrix representation is a matrix of what dimensions?
|
||||||
|
Back: $\lvert V \rvert \times \lvert V \rvert$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579435-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What values are found in an adjacency-matrix representation of a graph?
|
||||||
|
Back: $0$ and/or $1$.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579436-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
The following is an example of what kind of graph representation?
|
||||||
|
![[adj-matrix-representation.png]]
|
||||||
|
Back: An adjacency-matrix representation.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579437-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Are adjacency-matrix representations used for directed or undirected graphs?
|
||||||
|
Back: Both.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579438-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
For what graphs are adjacency-matrix representations symmetric along its diagonal?
|
||||||
|
Back: Undirected graphs.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579439-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*Why* is the adjacency-matrix representation of undirected graph $G = \langle V, E \rangle$ symmetric along its diagonal?
|
||||||
|
Back: If $\langle i, j \rangle \in E$ then $\langle j, i \rangle \in E$.
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579440-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $G = \langle V, E \rangle$. What is the memory usage of its adjacency-matrix representation?
|
||||||
|
Back: $\Theta(\lvert V \rvert^2)$
|
||||||
|
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1724614579441-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Bibliography
|
||||||
|
|
||||||
|
* Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -257,6 +257,14 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
||||||
<!--ID: 1724486757001-->
|
<!--ID: 1724486757001-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
In set theory, $\omega$ denotes what set?
|
||||||
|
Back: The natural numbers.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314391-->
|
||||||
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What is the smallest inductive set?
|
What is the smallest inductive set?
|
||||||
|
@ -281,6 +289,86 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
||||||
<!--ID: 1724486757010-->
|
<!--ID: 1724486757010-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What can be said about a subset of $\omega$?
|
||||||
|
Back: N/A.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314394-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What can be said about an inductive subset of $\omega$?
|
||||||
|
Back: It must coincide with $\omega$.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314396-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Why must every inductive subset of $\omega$ coincide with $\omega$?
|
||||||
|
Back: Because $\omega$ is the smallest inductive set.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314397-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does the induction principle for $\omega$ state?
|
||||||
|
Back: Every inductive subset of $\omega$ coincides with $\omega$.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314399-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What name is given to the principle, "every inductive subset of $\omega$ coincides with $\omega$?"
|
||||||
|
Back: The induction principle for $\omega$.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314400-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Inductive sets correspond to what kind of proof method?
|
||||||
|
Back: Proof by induction.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314401-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Prove $P(n)$ is true for all $n \in \mathbb{N}$ using induction. What set do we prove is inductive?
|
||||||
|
Back: $\{n \in \mathbb{N} \mid P(n)\}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314403-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*How* are inductive sets and proof by induction related?
|
||||||
|
Back: An induction proof corresponds to proving a related set is inductive.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314404-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What inductive set do we construct to prove the following by induction? $$\text{Every natural number is nonnegative}$$
|
||||||
|
Back: $\{n \in \omega \mid 0 \leq n\}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314405-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What inductive set do we construct to prove the following by induction? $$\text{Every nonzero natural number is the successor of another natural number}$$
|
||||||
|
Back: $\{n \in \omega \mid n = 0 \lor (\exists m \in \omega, n = m^+)\}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1724606314406-->
|
||||||
|
END%%
|
||||||
|
|
||||||
## Bibliography
|
## Bibliography
|
||||||
|
|
||||||
* Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
* Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
|
@ -10,7 +10,7 @@ tags:
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
A **free tree** is a connected, acyclic, undirected [[graphs|graph]]. If an undirected graph is acyclic but possibly disconnected, it is a **forest**.
|
A **free tree** is a connected, acyclic, undirected [[set/graphs|graph]]. If an undirected graph is acyclic but possibly disconnected, it is a **forest**.
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
|
@ -126,7 +126,7 @@ END%%
|
||||||
|
|
||||||
A **rooted tree** is a free tree in which one vertex is distinguished/blessed as the **root**. We call vertices of rooted trees **nodes**.
|
A **rooted tree** is a free tree in which one vertex is distinguished/blessed as the **root**. We call vertices of rooted trees **nodes**.
|
||||||
|
|
||||||
Let $T$ be a rooted tree with root $r$. Any node $y$ on the [[graphs#Paths|path]] from $r$ to node $x$ is an **ancestor** of $x$. Likewise, $x$ is a **descendant** of $y$. If the last edge on the path from $r$ to $x$ is $\{y, x\}$, $y$ is the **parent** of $x$ and $x$ is a **child** of $y$. Nodes with the same parent are called **siblings**.
|
Let $T$ be a rooted tree with root $r$. Any node $y$ on the [[set/graphs#Paths|path]] from $r$ to node $x$ is an **ancestor** of $x$. Likewise, $x$ is a **descendant** of $y$. If the last edge on the path from $r$ to $x$ is $\{y, x\}$, $y$ is the **parent** of $x$ and $x$ is a **child** of $y$. Nodes with the same parent are called **siblings**.
|
||||||
|
|
||||||
A node with no children is an **external node** or **leaf**. A node with at least one child is an **internal node** or **nonleaf**. The number of children of a node is the **degree** of said node. The length of the path from the root to a node $x$ is the **depth** of $x$ in $T$. A **level** of a tree consists of all nodes at the same depth. The **height** of a node in a tree is the length of the longest path from the node to a leaf.
|
A node with no children is an **external node** or **leaf**. A node with at least one child is an **internal node** or **nonleaf**. The number of children of a node is the **degree** of said node. The length of the path from the root to a node $x$ is the **depth** of $x$ in $T$. A **level** of a tree consists of all nodes at the same depth. The **height** of a node in a tree is the length of the longest path from the node to a leaf.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue