LCRS trees and set theory classes.

c-declarations
Joshua Potter 2024-05-17 12:33:05 -06:00
parent 037ea0f767
commit a81dcdf176
8 changed files with 280 additions and 7 deletions

View File

@ -127,7 +127,9 @@
"graph-isomorphic.png",
"graph-induced-subgraph.png",
"graph-subgraph.png",
"graph-non-subgraph.png"
"graph-non-subgraph.png",
"lcrs-nodes.png",
"binary-tree-nodes.png"
],
"File Hashes": {
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
@ -307,7 +309,7 @@
"_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f",
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
"set/index.md": "fd0afffa094e47aace1ec89428218eec",
"set/index.md": "923225a165d52476bee68d36ac2e4db3",
"set/graphs.md": "4bbcea8f5711b1ae26ed0026a4a69800",
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
"_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391",
@ -328,7 +330,7 @@
"x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2",
"x86-64/instructions.md": "c447f09c6b0ad504726c3232ff5871b4",
"git/refs.md": "e20c2c9b14ba6c2bd235416017c5c474",
"set/trees.md": "0d21b947917498f107da140cc9fb93a7",
"set/trees.md": "27bba3f28c31ad9effe9a99a43991bd4",
"_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6",
"_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b",
"_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9",
@ -430,7 +432,7 @@
"_journal/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b",
"_journal/2024-05/2024-05-12.md": "ca9f3996272152ef89924bb328efd365",
"git/remotes.md": "2208e34b3195b6f1ec041024a66fb38b",
"programming/pred-trans.md": "736e2c6e89494c8f5a2a7998aa905fdd",
"programming/pred-trans.md": "7006b05654a0485472166e81700c98f1",
"set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7",
"_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
"_journal/2024-05/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b",
@ -440,8 +442,8 @@
"_journal/2024-05-16.md": "580c7ec61ec56be92fa8d6affcf0a5f6",
"_journal/2024-05/2024-05-15.md": "4e6a7e6df32e93f0d8a56bc76613d908",
"logic/pred-logic.md": "c23c3da8756ac0ef17b9710a67440d84",
"logic/prop-logic.md": "4d45544452791470458cfb08656e16c1",
"_journal/2024-05-17.md": "4bada636652a610967c4ce51deb2ff43",
"logic/prop-logic.md": "f7d3ae42989c1c226c40c8354a546264",
"_journal/2024-05-17.md": "6e8033da97f16d9ce32b4d5762bcd573",
"_journal/2024-05/2024-05-16.md": "9fdfadc3f9ea6a4418fd0e7066d6b10c"
},
"fields_dict": {

View File

@ -8,4 +8,6 @@ title: "2024-05-17"
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
* Exploration of the law of [[pred-trans#Distributivity of Conjunction|Distributivity of Conjunction]].
* Exploration of the law of [[pred-trans#Distributivity of Conjunction|Distributivity of Conjunction]].
* Flashcards for left-child, right-sibling tree representations.
* Distinguish [[set/index#Classes|classes]] and sets. Discuss Zermelo-Fraenkel and von Neumann-Bernays alternatives.

View File

@ -238,6 +238,7 @@ Basic
Given propositions $p$ and $q$, $p \Leftrightarrow q$ is equivalent to the conjunction of what two expressions?
Back: $p \Rightarrow q$ and $q \Rightarrow p$.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047070-->
END%%
## Sets
@ -393,18 +394,21 @@ Basic
Given sets $a$ and $b$, $a = b$ is equivalent to the conjunction of what two expressions?
Back: $a \subseteq b$ and $b \subseteq a$.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047071-->
END%%
%%ANKI
Cloze
{$a \Rightarrow b$} is to propositional logic as {$a \subseteq b$} is to sets.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047073-->
END%%
%%ANKI
Cloze
{$a \Leftrightarrow b$} is to propositional logic as {$a = b$} is to sets.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047074-->
END%%
## Bibliography

View File

@ -306,12 +306,14 @@ Basic
What does Distributivity of Conjunction state?
Back: Given command $S$ and predicates $Q$ and $R$, $wp(S, Q \land R) = wp(S, Q) \land wp(S, R)$.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047060-->
END%%
%%ANKI
Cloze
Distributivity of Conjunction states {$wp(S, Q \land R)$} $=$ {$wp(S, Q) \land wp(S, R)$}.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047062-->
END%%
%%ANKI
@ -319,6 +321,7 @@ Basic
In Gries's exposition, is Distributivity of Conjunction taken as an axiom or a theorem?
Back: An axiom.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047064-->
END%%
%%ANKI
@ -326,6 +329,7 @@ Basic
Does $wp(S, Q) \land wp(S, R) \Rightarrow wp(S, Q \land R)$ hold when $S$ is nondeterministic?
Back: Yes.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047065-->
END%%
%%ANKI
@ -333,6 +337,7 @@ Basic
Does $wp(S, Q \land R) \Rightarrow wp(S, Q) \land wp(S, R)$ hold when $S$ is nondeterministic?
Back: Yes.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047067-->
END%%
%%ANKI
@ -340,6 +345,7 @@ Basic
What does it mean for command $S$ to be nondeterministic?
Back: Execution may not be the same even if begun in the same state.
Reference: Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1715969047068-->
END%%
## Bibliography

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -134,6 +134,129 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
<!--ID: 1715786028667-->
END%%
## Classes
The **Zermelo-Fraenkel alternative** avoids speaking of collections defined using set theoretical notation that are not sets. The **von Neumann-Bernays** alternative calls these **classes**.
%%ANKI
Basic
In set theory, what is a class?
Back: A collection defined using set theoretical notation that isn't a set.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576758-->
END%%
%%ANKI
Basic
Which two alternatives are usually employed when speaking of classes?
Back: The Zermelo-Fraenkel alternative and the von Neumann-Bernays alternative.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576761-->
END%%
%%ANKI
Basic
What does the Zermelo-Fraenkel alternative say about classes?
Back: It gives it no ontological status at all.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576763-->
END%%
%%ANKI
Basic
What does the von Neumann-Bernays alternative say about classes?
Back: It refers to objects defined using set theory but that aren't actually sets.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576765-->
END%%
%%ANKI
Cloze
The {1:Zermelo}-{2:Fraenkel} alternative is a separate approach from the {2:von Neumann}-{1:Bernays} alternative.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576766-->
END%%
%%ANKI
Basic
Which set theory alternative avoids the term "class"?
Back: The Zermelo-Fraenkel alternative.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576768-->
END%%
%%ANKI
Basic
Which set theory alternative embraces the term "class"?
Back: The von Neumann-Bernays alternative.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576769-->
END%%
%%ANKI
Basic
What kind of mathematical object is $\{x \mid x \neq x\}$?
Back: A set.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576771-->
END%%
%%ANKI
Basic
What name is given to $\{x \mid x \neq x\}$?
Back: The empty set.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576772-->
END%%
%%ANKI
Basic
What kind of mathematical object is $\{x \mid x = x\}$?
Back: A class.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576774-->
END%%
%%ANKI
Basic
What name is given to $\{x \mid x = x\}$?
Back: The class of all sets.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576775-->
END%%
%%ANKI
Basic
Are sets or classes more general?
Back: Classes.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576777-->
END%%
%%ANKI
Basic
Is every set a class?
Back: Yes.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576779-->
END%%
%%ANKI
Basic
Is every class a set?
Back: No.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576781-->
END%%
%%ANKI
Basic
Assuming entrance requirement $\_\_\_$, what kind of mathematical object is $\{x \mid \_\_\_\}$?
Back: A class.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1715970576782-->
END%%
## Bibliography
* Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).

View File

@ -722,6 +722,134 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition
<!--ID: 1712409466682-->
END%%
%%ANKI
Basic
What $O(n)$ space representation is commonly used for ordered trees with unbounded branching?
Back: A left-child, right-sibling tree representation.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969047043-->
END%%
%%ANKI
Basic
A node of a left-child, right-sibling tree representation has what three pointers?
Back: The parent, left child, and right sibling.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969047046-->
END%%
%%ANKI
Basic
What is the space usage of a left-child, right-sibling representation?
Back: Given $n$ nodes in the tree, $O(n)$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969047047-->
END%%
%%ANKI
Basic
What space may be wasted in a $k$-child representation of a $k$-ary tree?
Back: Some children may be absent.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969047049-->
END%%
%%ANKI
Basic
What space advantage does a left-child, right-sibling representation have over a $k$-child representation?
Back: Absent children are not stored in the former.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969047051-->
END%%
%%ANKI
Basic
How is a `struct` of a $k$-child tree representation written?
Back:
```c
struct Node {
struct Node *parent;
struct Node *children[k];
};
```
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: c17
<!--ID: 1715969047052-->
END%%
%%ANKI
Basic
What tree representation corresponds to the following `struct`?
```c
struct Node {
struct Node *parent;
struct Node *children[k];
};
```
Back: A $k$-ary child representation.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: c17
<!--ID: 1715969047054-->
END%%
%%ANKI
Basic
How is a `struct` of a left-child, right-sibling tree representation written?
Back:
```c
struct Node {
struct Node *parent;
struct Node *left;
struct Node *next;
};
```
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: c17
<!--ID: 1715969047056-->
END%%
%%ANKI
Basic
What tree representation corresponds to the following `struct`?
```c
struct Node {
struct Node *parent;
struct Node *left;
struct Node *next;
};
```
Back: A left-child, right-sibling representation.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: c17
<!--ID: 1715969047057-->
END%%
%%ANKI
Basic
What is an LCRS tree representation?
Back: A **l**eft-**c**hild, **r**ight-**s**ibling representation.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969525815-->
END%%
%%ANKI
Basic
The following is a portion of what kind of tree representation?
![[lcrs-nodes.png]]
Back: A left-child, right-sibling representation.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969525819-->
END%%
%%ANKI
Basic
The following is a portion of what kind of tree representation?
![[binary-tree-nodes.png]]
Back: A $k$-ary (binary) child representation.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969525820-->
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.
@ -1454,6 +1582,14 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition
<!--ID: 1714349367662-->
END%%
%%ANKI
Basic
A node of a binary tree typically has what three pointers?
Back: The parent, left child, and right child.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715969047059-->
END%%
## Bibliography
* “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees).