diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index 0ff7405..a1f9c30 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -148,7 +148,7 @@ "_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180", "_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb", "_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", - "logic/equiv-trans.md": "1198fbea260527e7dfd17b72955f5bee", + "logic/equiv-trans.md": "4de3b5412f29b080a5f9f3629db38389", "_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9", @@ -310,7 +310,7 @@ "x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2", "x86-64/instructions.md": "240b4ceddf174f48207ba6bed4d25246", "git/refs.md": "954fc69004aa65b358ec5ce07c1435ce", - "set/trees.md": "fd092c77c26d0b99b3131da6dc043edd", + "set/trees.md": "0e2d146f7e952aa4575e4daa82301ecd", "_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6", "_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b", "_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9", @@ -334,13 +334,16 @@ "_journal/2024-04-06.md": "1e3e0aa30b92987e6d53d5a366963b95", "_journal/2024-04/2024-04-05.md": "c829cead37580ed6ece0f98497d71147", "_journal/2024-04-11.md": "23b873dd315e716ad9ee5f107f9cfefc", - "_journal/2024-04/2024-04-10.md": "8ada51600e1bdafd37a5552ae67281e6", + "_journal/2024-04/2024-04-10.md": "e91fe6eb3d2ef5af5a293e4f92022faa", "_journal/2024-04/2024-04-09.md": "20eeafed43b6bc48786133c3523e1029", "_journal/2024-04/2024-04-08.md": "764b40fc657740d024b54ddd51ffb153", "_journal/2024-04/2024-04-07.md": "848b6c8702e799c38e4f5dc506891bf7", "_journal/2024-04/2024-04-06.md": "14482b513cbe15904f1b8d81b5a143d0", "_journal/2024-04-12.md": "18955288bcdacf24c3d9d4b2a5b2e6d7", - "_journal/2024-04/2024-04-11.md": "9c248442a03080cf2942436a617edfef" + "_journal/2024-04/2024-04-11.md": "5baeb12bc5cc5492af766def8f849fb4", + "_journal/2024-04-14.md": "b51ad215e566bd96617d2817484232eb", + "_journal/2024-04/2024-04-13.md": "92db6bcb162a85fb0a4afd51999b6318", + "_journal/2024-04/2024-04-12.md": "1ec32792d88d470c2d517e5caf64fd6f" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-04-14.md b/notes/_journal/2024-04-14.md new file mode 100644 index 0000000..6c4f976 --- /dev/null +++ b/notes/_journal/2024-04-14.md @@ -0,0 +1,11 @@ +--- +title: "2024-04-14" +--- + +- [ ] Anki Flashcards +- [ ] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) +- [ ] Interview Prep (1 Practice Problem) +- [ ] Log Work Hours (Max 3 hours) \ No newline at end of file diff --git a/notes/_journal/2024-04-13.md b/notes/_journal/2024-04/2024-04-13.md similarity index 70% rename from notes/_journal/2024-04-13.md rename to notes/_journal/2024-04/2024-04-13.md index 6b54687..ce75ab5 100644 --- a/notes/_journal/2024-04-13.md +++ b/notes/_journal/2024-04/2024-04-13.md @@ -8,4 +8,6 @@ title: "2024-04-13" - [ ] Go (1 Life & Death Problem) - [ ] Korean (Read 1 Story) - [ ] Interview Prep (1 Practice Problem) -- [x] Log Work Hours (Max 3 hours) \ No newline at end of file +- [x] Log Work Hours (Max 3 hours) + +* Play tested the hide-and-seek application \ No newline at end of file diff --git a/notes/set/trees.md b/notes/set/trees.md index 93d65de..16a2178 100644 --- a/notes/set/trees.md +++ b/notes/set/trees.md @@ -121,6 +121,8 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% +## Rooted Trees + 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 simple 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**. @@ -596,6 +598,8 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% +### Ordered Trees + An **ordered tree** is a rooted tree in which the children of each node are ordered. %%ANKI @@ -656,6 +660,35 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% +%%ANKI +Basic +Considered as rooted trees, are the following trees the same? +![[ordered-binary-tree-cmp.png]] +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Considered as ordered trees, are the following trees the same? +![[ordered-binary-tree-cmp.png]] +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Considered as binary trees, are the following trees the same? +![[ordered-binary-tree-cmp.png]] +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +### Binary Trees + A **binary tree** $T$ is a structure defined on a finite set of nodes that either * contains no nodes, or @@ -780,30 +813,21 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% %%ANKI -Basic -Considered as rooted trees, are the following trees the same? -![[ordered-binary-tree-cmp.png]] +Is a binary tree a $k$-ary tree? Back: Yes. Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - END%% -%%ANKI -Basic -Considered as ordered trees, are the following trees the same? -![[ordered-binary-tree-cmp.png]] +ANKI%% +Is a $k$-ary tree a positional tree? Back: Yes. Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - END%% -%%ANKI -Basic -Considered as binary trees, are the following trees the same? -![[ordered-binary-tree-cmp.png]] -Back: No. +ANK%% +Is a positional tree a $k$-ary tree? +Back: Not necessarily. Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - END%% %%ANKI @@ -815,6 +839,231 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% +### Positional Trees + +A **positional tree** is a rooted tree in which each child is labeled with a specific positive integer. A **$k$-ary tree** is a positional tree with at most $k$ children/labels. A binary tree is a $2$-ary tree. + +A $k$-ary tree is **full** if every node has degree $0$ or $k$. A $k$-ary tree is **complete** if all leaves have the same depth and all internal nodes have degree $k$. + +%%ANKI +Basic +What does it mean for a binary tree to be full? +Back: Each node has $0$ or $2$ children. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +What does it mean for a binary tree to be complete? +Back: Each leaf has the same depth and all internal nodes have degree $2$. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +What degrees are permitted in a full binary tree? +Back: $0$ or $2$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +What degrees are permitted in a complete binary tree? +Back: $0$ or $2$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +What category of rooted tree does a binary tree fall under? +Back: A positional tree or $k$-ary tree. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +Basic +What distinguishes a positional tree from a $k$-ary tree? +Back: A $k$-ary tree is a positional tree in which each node has at most $k$ children. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What distinguishes positional trees from ordered trees? +Back: The same children in different positions is considered distinct in the former. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a positional tree? +Back: A rooted tree in which each child is labeled with a specific positive integer. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a $k$-ary tree? +Back: A positional tree in which each node has at most $k$ children. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which of positional trees or $k$-ary trees are more general? +Back: The positional tree. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which of positional trees or $k$-ary trees are more general? +Back: The positional tree. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +Basic +Is a binary tree a positional tree? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Is the concept of fullness related to positional trees or $k$-ary trees? +Back: $k$-ary trees. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +Basic +Is the concept of completeness related to positional trees or $k$-ary trees? +Back: $k$-ary trees. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean for a $k$-ary tree to be full? +Back: Each node has $0$ or $k$ children. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What degrees are permitted in a full $k$-ary tree? +Back: $0$ or $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What degrees are permitted in a complete $k$-ary tree? +Back: $0$ or $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean for a $k$-ary tree to be complete? +Back: All leaves have the same depth and all internal nodes have degree $k$. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the degree of an internal node in a complete $k$-ary tree'? +Back: $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the degree of an external node in a complete $k$-ary tree'? +Back: $0$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How many levels exist in a rooted tree of height $h$? +Back: $h + 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the height of a rooted tree with $k$ levels? +Back: $k - 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What recursive definition describes the number of nodes in each levelof a complete $k$-ary tree? +Back: $a_n = k \cdot a_{n-1}$ with $a_0 = 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What recursive definition describes the number of nodes in each level of a complete $k$-ary tree? +Back: $a_n = k \cdot a_{n-1}$ with $a_0 = 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What closed formula details the number of nodes in a complete $k$-ary tree of height $h$? +Back: $$\frac{1 - k^h}{1 - k}$$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What kind of sequence describes the number of nodes in a complete $k$-ary tree? +Back: A geometric sequence. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What is the common ratio in the geometric sequence counting nodes of a complete $k$-ary tree? +Back: $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many nodes are in a complete binary tree of height $h$? +Back: $$\frac{1 - 2^h}{1 - 2} = 2^h - 1$$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + ## Bibliography -* Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). \ No newline at end of file +* Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).