Cardinal numbers and BFS/DFS.
parent
213734d90f
commit
18b56232d8
|
@ -632,7 +632,7 @@
|
|||
"_journal/2024-06/2024-06-12.md": "f82dfa74d0def8c3179d3d076f94558e",
|
||||
"_journal/2024-06-14.md": "5d12bc272238ac985a1d35d3d63ea307",
|
||||
"_journal/2024-06/2024-06-13.md": "e2722a00585d94794a089e8035e05728",
|
||||
"set/functions.md": "7cee6b7684ca51b706bce617b8d06c90",
|
||||
"set/functions.md": "a7062cbcbbee036de8133380a90135f9",
|
||||
"_journal/2024-06-15.md": "92cb8dc5c98e10832fb70c0e3ab3cec4",
|
||||
"_journal/2024-06/2024-06-14.md": "8bbe0e1ca371756b91eec66af73911ce",
|
||||
"lambda-calculus/beta-reduction.md": "0935987f2bac0e6298735f2b26fd5885",
|
||||
|
@ -869,7 +869,7 @@
|
|||
"_journal/2024-09/2024-09-20.md": "69cf79bb0cb8c116a9c0f671671fdc44",
|
||||
"_journal/2024-09-22.md": "2d00b00b4eb9964465f30210187603cf",
|
||||
"_journal/2024-09/2024-09-21.md": "2e6425f4db0187082947c3e0cb24f754",
|
||||
"algorithms/bfs.md": "082644a948180337a0065bb11d28aff9",
|
||||
"algorithms/bfs.md": "2baad5ef237e596ca1808d759e63aa72",
|
||||
"_journal/2024-09-23.md": "c0a87ca092a36e2761e844f34296f2f7",
|
||||
"_journal/2024-09/2024-09-22.md": "c27835ce1d82d10c906b40b420145d0c",
|
||||
"_journal/2024-09-25.md": "4527ac5c132aaf5adc6e624c5e4aca5e",
|
||||
|
@ -917,7 +917,7 @@
|
|||
"_journal/2024-10/2024-10-16.md": "cd778e1be2737462d885ae038c7b9744",
|
||||
"_journal/2024-10/2024-10-15.md": "c21679bd2c3b29f5a86d56a1fd23b18f",
|
||||
"_journal/2024-10-22.md": "4af65962007cfecdb2c679b44b56d25f",
|
||||
"algorithms/dfs.md": "5fe40544db71b5cc79f4f8149478fc8e",
|
||||
"algorithms/dfs.md": "48f87e5976e1a9469b009346332ea92d",
|
||||
"_journal/2024-10/2024-10-21.md": "de1a0861e87df29aeff11a291f8fbd45",
|
||||
"_journal/2024-10-23.md": "51b2ca6edf23b6a64fd7d3638a0b54cb",
|
||||
"_journal/2024-10/2024-10-22.md": "5ff4eb7eba58e77c4fb65b7162a485e6",
|
||||
|
@ -969,7 +969,7 @@
|
|||
"_journal/2024-11/2024-11-21.md": "951b6034d60a40dbd8201c50abf0dbb9",
|
||||
"_journal/2024-11/2024-11-20.md": "951b6034d60a40dbd8201c50abf0dbb9",
|
||||
"_journal/2024-11/2024-11-19.md": "d879f57154cb27cb168eb1f1f430e312",
|
||||
"set/cardinality.md": "29566dcf1454b9eed649b7d8c4d2335b",
|
||||
"set/cardinality.md": "5da2685e8a2e210d3923f81369ad7028",
|
||||
"geometry/area.md": "7f947bb5ac782495a1fb4a63bb2463e7",
|
||||
"_journal/2024-11-23.md": "911f82ab8aede5ecdb96493aef64b0b9",
|
||||
"_journal/2024-11/2024-11-22.md": "51117030e2364dbce3a8d507dead86ae",
|
||||
|
@ -1059,7 +1059,9 @@
|
|||
"_journal/2024-12/2024-12-22.md": "75375a867efc5b3aff406c73394d4814",
|
||||
"computability/language.md": "9ee8bd16c231e71855ab1d8dae3188cb",
|
||||
"posix/bash.md": "0bb06efa5d62635595f1a005be5bcbde",
|
||||
"computability/regexp.md": "623753e4d631d12f6e80a83d7bde2301"
|
||||
"computability/regexp.md": "623753e4d631d12f6e80a83d7bde2301",
|
||||
"_journal/2024-12-24.md": "d26217e8cc96080d232b86f9f8a08c65",
|
||||
"_journal/2024-12/2024-12-23.md": "72b0964a8a5ed8ba0acf7fe10b5de279"
|
||||
},
|
||||
"fields_dict": {
|
||||
"Basic": [
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
title: "2024-12-24"
|
||||
---
|
||||
|
||||
- [ ] Anki Flashcards
|
||||
- [ ] KoL
|
||||
- [x] Anki Flashcards
|
||||
- [x] KoL
|
||||
- [ ] OGS
|
||||
- [ ] Sheet Music (10 min.)
|
||||
- [ ] Korean (Read 1 Story)
|
||||
- [ ] Korean (Read 1 Story)
|
||||
|
||||
* Basic identities regarding cardinal numbers.
|
||||
* Additional notes on BFS and DFS as well as DFS edge classifications.
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Breadth-First Search
|
||||
TARGET DECK: Obsidian::STEM
|
||||
FILE TAGS: algorithm data_structure::graph
|
||||
FILE TAGS: algorithm::bfs data_structure::graph
|
||||
tags:
|
||||
- bfs
|
||||
- graph
|
||||
|
@ -13,6 +13,8 @@ Bread-first search operates on a graph $G = \langle V, E \rangle$ and a **source
|
|||
|
||||
![[bfs.gif]]
|
||||
|
||||
To keep track of progress, BFS colors each vertex white, gray, or black. All vertices start out white. They are colored gray upon discovery. They are painted black once all edges have been explored.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is BFS an acronym for?
|
||||
|
@ -28,13 +30,6 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
|||
<!--ID: 1727042295717-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
The {1:source} of breadth-first {2:search} is the {2:root} of the breadth-first {1:tree}.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727042295723-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which of undirected and directed graphs is BFS applicable to?
|
||||
|
@ -43,38 +38,6 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
|||
<!--ID: 1727042295728-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, what does the predecessor of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727042295733-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, what does the parent of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727042295739-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, the predecessor of a node is also known as what?
|
||||
Back: The parent of the node.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727044035958-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, the parent of a node is also known as what?
|
||||
Back: The predecessor of the node.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727044035963-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What ADT is typically used to manage the set of most recently discovered BFS vertices?
|
||||
|
@ -97,12 +60,13 @@ What basic graph algorithm is the following a demonstration of?
|
|||
![[bfs.gif]]
|
||||
Back: Breadth-first search.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
Tags: algorithm::dfs
|
||||
<!--ID: 1727044035969-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
In BFS, what happens to the nodes found within the internal queue?
|
||||
What happens to nodes found within the internal queue?
|
||||
Back: Undiscovered nodes adjacent to those in the queue are enqueued.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727044035972-->
|
||||
|
@ -113,6 +77,7 @@ Basic
|
|||
Which of BFS or DFS is used to find shortest paths?
|
||||
Back: BFS.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
Tags: algorithm::dfs
|
||||
<!--ID: 1727044035975-->
|
||||
END%%
|
||||
|
||||
|
@ -180,6 +145,114 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
|||
<!--ID: 1727044184066-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What does a white vertex typically represent?
|
||||
Back: A vertex that has not been discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a white vertex painted gray?
|
||||
Back: Upon discovery.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a white vertex painted black?
|
||||
Back: N/A. It must be painted gray before it's painted black.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What does a gray vertex typically represent?
|
||||
Back: A vertex that is in the queue, i.e. the frontier discovery happens against.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a gray vertex painted white?
|
||||
Back: N/A.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a gray vertex painted black?
|
||||
Back: After all of its edges have been examined.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What does a black vertex typically represent?
|
||||
Back: A vertex whose edges have all been explored.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
## Breadth-First Forests
|
||||
|
||||
To color an entire graph black, BFS may need to be invoked multiple times. After each invocation of BFS, a new invocation can be run with any remaining white vertex as the source. Each invocation yields a **breadth-first tree**. Multiple invocations yield a **breadth-first forest**.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When might white vertices remain after BFS is invoked?
|
||||
Back: When there exist vertices unreachable from the last used source vertex.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276213-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many invocations of BFS are required to color a graph black?
|
||||
Back: One or more.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276214-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
The {1:source} of a breadth-first {2:search} is the {2:root} of a breadth-first {1:tree}.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727042295723-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, what does the predecessor of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727042295733-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, what does the parent of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727042295739-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, the predecessor of a node is also known as what?
|
||||
Back: The parent of the node.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727044035958-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to breadth-first trees, the parent of a node is also known as what?
|
||||
Back: The predecessor of the node.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1727044035963-->
|
||||
END%%
|
||||
|
||||
## Bibliography
|
||||
|
||||
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Depth-First Search
|
||||
TARGET DECK: Obsidian::STEM
|
||||
FILE TAGS: algorithm data_structure::graph
|
||||
FILE TAGS: algorithm::dfs data_structure::graph
|
||||
tags:
|
||||
- dfs
|
||||
- graph
|
||||
|
@ -13,6 +13,10 @@ Depth-first search operates on a graph $G = \langle V, E \rangle$ and a **source
|
|||
|
||||
![[dfs.gif]]
|
||||
|
||||
To keep track of progress, DFS colors each vertex white, gray, or black. All vertices start out white. They are colored gray upon discovery. They are painted black once all edges have been explored.
|
||||
|
||||
Vertices also typically have two timestamps recorded: on discovery and on finish.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is DFS an acronym for?
|
||||
|
@ -36,14 +40,6 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
|||
<!--ID: 1729641729231-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to depth-first trees, what does the predecessor of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1729641729235-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What ADT is typically used to manage the set of most recently discovered DFS vertices?
|
||||
|
@ -56,6 +52,7 @@ END%%
|
|||
Cloze
|
||||
A {1:queue} is to {2:BFS} whereas a {2:stack} is to {1:DFS}.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
Tags: algorithm::bfs
|
||||
<!--ID: 1729641729242-->
|
||||
END%%
|
||||
|
||||
|
@ -73,6 +70,7 @@ What basic graph algorithm is the following a demonstration of?
|
|||
![[dfs.gif]]
|
||||
Back: Depth-first search.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
Tags: algorithm::bfs
|
||||
<!--ID: 1729641729249-->
|
||||
END%%
|
||||
|
||||
|
@ -124,6 +122,234 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
|||
<!--ID: 1729641729272-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What does a white vertex typically represent?
|
||||
Back: A vertex that has not been discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276185-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a white vertex painted gray?
|
||||
Back: Upon discovery.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276187-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a white vertex painted black?
|
||||
Back: N/A. It must be painted gray before it's painted black.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276188-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What does a gray vertex typically represent?
|
||||
Back: A vertex that is in the queue, i.e. the frontier discovery happens against.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276189-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a gray vertex painted white?
|
||||
Back: N/A.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276191-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When is a gray vertex painted black?
|
||||
Back: After all of its edges have been examined.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276193-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What does a black vertex typically represent?
|
||||
Back: A vertex whose edges have all been explored.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276195-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What two timestamps are associated with each vertex?
|
||||
Back: A timestamp on discovery and a timestamp when finished processing.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276196-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What range of values can a timestamp $t$ take on?
|
||||
Back: $1 \leq t \leq 2\lvert V \rvert$
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276198-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Suppose vertex $v$ has discovery time $d$ and finish time $f$. When was $v$ colored white?
|
||||
Back: At timestamps $< f$.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276199-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Suppose vertex $v$ has discovery time $d$ and finish time $f$. When was $v$ colored gray?
|
||||
Back: At timestamps $\geq d$ and $< f$.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276200-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Suppose vertex $v$ has discovery time $d$ and finish time $t$. When was $v$ colored black?
|
||||
Back: At timestamps $\geq f$.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276201-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What aspect of DFS has parenthesis structure?
|
||||
Back: The discovery and finish timestamps of vertices.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276202-->
|
||||
END%%
|
||||
|
||||
## Depth-First Forests
|
||||
|
||||
To color an entire graph black, BFS may need to be invoked multiple times. After each invocation of BFS, a new invocation can be run with any remaining white vertex as the source. Each invocation yields a **depth-first tree**. Multiple invocations yield a **depth-first forest**.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to depth-first trees, what does the predecessor of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1729641729235-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
When might white vertices remain after DFS is invoked?
|
||||
Back: When there exist vertices unreachable from the last used source vertex.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276203-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many invocations of DFS are required to color a graph black?
|
||||
Back: One or more.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276205-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
The {1:source} of a depth-first {2:search} is the {2:root} of a depth-first {1:tree}.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276206-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to depth-first trees, what does the predecessor of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to depth-first trees, what does the parent of a node $N$ refer to?
|
||||
Back: The node from which $N$ was discovered.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276207-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to depth-first trees, the predecessor of a node is also known as what?
|
||||
Back: The parent of the node.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276209-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
With respect to depth-first trees, the parent of a node is also known as what?
|
||||
Back: The predecessor of the node.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
<!--ID: 1735081276210-->
|
||||
END%%
|
||||
|
||||
### Edge Classification
|
||||
|
||||
A depth-first forest can contain four different types of edges:
|
||||
|
||||
1. A **tree edge** is an edge $\langle u, v \rangle$ such that $v$ was first discovered by exploring edge $\langle u, v \rangle$.
|
||||
2. A **back edge** is an edge $\langle u, v \rangle$ connecting vertex $u$ to an ancestor $v$.
|
||||
1. Self-loops are considered back edges.
|
||||
3. A **forward edge** is a non-tree edge $\langle u, v \rangle$ connecting vertex $u$ to a proper descendant $v$.
|
||||
4. A **cross edge** is any other edge.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many edge types might there exist in a depth-first forest?
|
||||
Back: Four.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What are the different edge types possibly found in a depth-first forest?
|
||||
Back: Tree, forward, back, and cross.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\langle u, v \rangle$ be an edge in a depth-first forest. When is $\langle u, v \rangle$ a tree edge?
|
||||
Back: When $v$ was first discovered along edge $\langle u, v \rangle$.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\langle u, v \rangle$ be an edge in a depth-first forest. When is $\langle u, v \rangle$ a back edge?
|
||||
Back: When $v$ is an ancestor of edge $u$.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\langle u, v \rangle$ be an edge in a depth-first forest. When is $\langle u, v \rangle$ a forward edge?
|
||||
Back: When $\langle u, v \rangle$ is a non-tree edge such that $v$ is a proper descendant of $u$.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Let $\langle u, v \rangle$ be an edge in a depth-first forest. When is $\langle u, v \rangle$ a cross edge?
|
||||
Back: When $\langle u, v \rangle$ is not a tree, forward, or back edge.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What kind of edge is a self-loop in a depth-first forest classified as?
|
||||
Back: A back edge.
|
||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||
END%%
|
||||
|
||||
## Bibliography
|
||||
|
||||
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
|
@ -703,6 +703,14 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
|||
<!--ID: 1733675522751-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Suppose sets $A$ and $B$ are finite. When is $^BA$ infinite?
|
||||
Back: N/A. The set of functions from one finite set to another is always finite.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143693-->
|
||||
END%%
|
||||
|
||||
### Addition
|
||||
|
||||
Let $\kappa$ and $\lambda$ be any cardinal numbers. Then $\kappa + \lambda = \mathop{\text{card}}(K \cup L)$, where $K$ and $L$ are any disjoint sets of cardinality $\kappa$ and $\lambda$, respectively.
|
||||
|
@ -818,6 +826,38 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
|||
<!--ID: 1734520487333-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. Does $\kappa + \lambda = \lambda + \kappa$?
|
||||
Back: Yes.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143694-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. *Why* does $\kappa + \lambda = \lambda + \kappa$?
|
||||
Back: Because the union of sets is commutative.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143695-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. Does $\kappa + (\lambda + \mu) = (\kappa + \lambda) + \mu$?
|
||||
Back: Yes.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143696-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. *Why* does $\kappa + (\lambda + \mu) = (\kappa + \lambda) + \mu$?
|
||||
Back: Because the union of sets is associative.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143697-->
|
||||
END%%
|
||||
|
||||
### Multiplication
|
||||
|
||||
Let $\kappa$ and $\lambda$ be any cardinal numbers. Then $\kappa \cdot \lambda = \mathop{\text{card}}(K \times L)$, where $K$ and $L$ are any sets of cardinality $\kappa$ and $\lambda$, respectively.
|
||||
|
@ -956,6 +996,62 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
|||
<!--ID: 1734803273746-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. Does $\kappa \cdot \lambda = \lambda \cdot \kappa$?
|
||||
Back: Yes.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143698-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. *Why* does $\kappa \cdot \lambda = \lambda \cdot \kappa$?
|
||||
Back: Because $K \times L \approx L \times K$ for any sets $K$ and $L$.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143699-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. Does $\kappa \cdot (\lambda \cdot \mu) = (\kappa \cdot \lambda) \cdot \mu$?
|
||||
Back: Yes.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143700-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. *Why* does $\kappa \cdot (\lambda \cdot \mu) = (\kappa \cdot \lambda) \cdot \mu$?
|
||||
Back: Because $K \times (L \times M) \approx (K \times L) \times M$ for any sets $K$, $L$, and $M$.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143701-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. What does the distributive property state?
|
||||
Back: $\kappa \cdot (\lambda + \mu) = (\kappa \cdot \lambda) + (\kappa \cdot \mu)$
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143702-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. *Why* does $\kappa \cdot (\lambda + \mu) = (\kappa \cdot \lambda) + (\kappa \cdot \mu)$?
|
||||
Back: Because the Cartesian product distributes over the union operation.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143703-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. What does $\kappa \cdot (\lambda + 1)$ evaluate to?
|
||||
Back: $\kappa \cdot \lambda + \kappa$
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143704-->
|
||||
END%%
|
||||
|
||||
### Exponentiation
|
||||
|
||||
Let $\kappa$ and $\lambda$ be any cardinal numbers. Then $\kappa^\lambda = \mathop{\text{card}}(^LK)$, where $K$ and $L$ are any sets of cardinality $\kappa$ and $\lambda$, respectively.
|
||||
|
@ -1079,6 +1175,67 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
|||
<!--ID: 1734520487388-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. Does $\kappa ^ \lambda = \lambda ^ \kappa$?
|
||||
Back: Not necessarily.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143705-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. Then $\kappa^{\lambda + \mu} =$ {$\kappa^\lambda \cdot \kappa^\mu$}.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143706-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. Then $(\kappa \cdot \lambda)^\mu =$ {$\kappa^\mu \cdot \lambda^\mu$}.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143707-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. Then $(\kappa^\lambda)^\mu =$ {$\kappa^{\lambda \cdot \mu}$}.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143708-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. What $\lambda$-calculus concept does $(\kappa^\lambda)^\mu = \kappa^{\lambda \cdot \mu}$ embody?
|
||||
Back: Currying.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143709-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ and $\lambda$ be cardinal numbers. Rewrite $\kappa^{\lambda + 1}$ without using addition.
|
||||
Back: $\kappa^\lambda \cdot \kappa$
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143710-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ be a cardinal number. How is the factorial of $\kappa$ denoted?
|
||||
Back: $\kappa !$
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143711-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Let $\kappa$ be a cardinal number. How is the factorial of $\kappa$ defined?
|
||||
Back: As $\mathop{\text{card}} \{ f \mid f \text{ is a permutation of } K\}$ for some $\mathop{\text{card}} K = \kappa$.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143712-->
|
||||
END%%
|
||||
|
||||
## Bibliography
|
||||
|
||||
* Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
|
@ -252,6 +252,14 @@ Reference: “Operation (Mathematics).” In _Wikipedia_, October 10, 2024. [htt
|
|||
<!--ID: 1729804914213-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is a permutation defined using the concept of functions?
|
||||
Back: A permutation of a set $A$ is a one-to-one function from $A$ to $A$.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1735074143690-->
|
||||
END%%
|
||||
|
||||
## Injections
|
||||
|
||||
A function is **injective** or **one-to-one** if each element of the codomain is mapped to by at most one element of the domain.
|
||||
|
|
Loading…
Reference in New Issue