Add notes on trees.

c-declarations
Joshua Potter 2024-03-24 07:14:26 -06:00
parent 4b65764c89
commit fc2c614e81
12 changed files with 696 additions and 56 deletions

View File

@ -102,17 +102,21 @@
"infinity.png",
"nan.png",
"directed-graph-example.png",
"undirected-graph-example.png"
"undirected-graph-example.png",
"free-tree.png",
"forest.png",
"cyclic-undirected.png",
"rooted-tree.png"
],
"File Hashes": {
"algorithms/index.md": "f63290ca8d7aad1840797ec699188e9e",
"algorithms/sorting/index.md": "2d5a18a3079d96fa9e3d4289181a8b6c",
"algorithms/sorting/insertion-sort.md": "bdac9a5836611d6136b65367bed521e7",
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
"algorithms/sorting/index.md": "4a66e28bce754de5df31ec2f4aed7e93",
"algorithms/sorting/insertion-sort.md": "b352f91800ab87e60c58dbfaf3ae959e",
"bash/index.md": "22083ea1ee9505cc96b02f82f63ba2c9",
"bash/prompts.md": "61cb877e68da040a15b85af76b1f68ba",
"bash/prompts.md": "cc51c210fa819338d4e95658955173df",
"bash/quoting.md": "b1d8869a91001f8b22f0cdc54d806f61",
"bash/robustness.md": "6f3e4ec7c321b2f3f94a01c18f675d1e",
"bash/shebang.md": "9006547710f9a079a3666169fbeda7aa",
"bash/robustness.md": "a3d924e0c58bbf0a2f2b0482f5cf94b6",
"bash/shebang.md": "577e32f9f508625fd9b4002a7a26b211",
"c/escape-sequences.md": "7b4bbf159908320249158acfe47a9074",
"c/index.md": "a021c92f19831bdd2bca4cbf813882fe",
"gawk/index.md": "e4da41ba6a2c2602d9f15f2930608e3c",
@ -123,14 +127,14 @@
"journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"journal/2024-02-03.md": "c6d411f0e2e964270399dd3a99f48382",
"logic/index.md": "46cdc7a552900e99a7d2d0140971118c",
"logic/propositional.md": "a72983987cd89df9a451973a4d45e82d",
"logic/propositional.md": "1ac07079aff07a7c2cb09daacefbb960",
"lua/index.md": "fd3d0b66765f0e9df233e8e02ce33e94",
"nix/callPackage.md": "140a02e57cd01d646483e3c21d72243d",
"nix/callPackage.md": "8ab988c8f1982ff047c706c5d66b69c7",
"nix/index.md": "4efc7fcc4ea22834ba595497e5fb715c",
"posix/index.md": "97b1b8ecb9a953e855a9acf0ab25b8c8",
"posix/signals.md": "e8a62cbece8a6bfc54a4e67bbdf3be7c",
"posix/signals.md": "f4132369878c683bfac4d7fd863d19ba",
"templates/daily.md": "7866014e730e85683155207a02e367d8",
"posix/regexp.md": "eb1e686756c283a60a7213d3ed39e78b",
"posix/regexp.md": "cb53e537fc10ce83307f35497d48179f",
"journal/2024-02-04.md": "e2b5678fc53d7284b71ed6820c02b954",
"gawk/regexp.md": "d9229f1eabe1b99e965eecaa03bee86c",
"_templates/daily.md": "5863e4524f8d012e153918d238c611a4",
@ -141,22 +145,22 @@
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"logic/equiv-trans.md": "315997b803b0748f5fc76d912ad97cda",
"logic/equiv-trans.md": "00c899a0a6a868a580a19cb11c416997",
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "e39f4aa253f0baf908067bea81f6bced",
"algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9",
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
"algorithms/order-growth.md": "513ea484fcdc184170205a425be77742",
"algorithms/order-growth.md": "12bf6c10653912283921dcc46c7fa0f8",
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
"algorithms/sorting/selection-sort.md": "5ba56adddaf07653290af88f998f6c4a",
"algorithms/sorting/selection-sort.md": "0dc0b5237cf992e97b78f2584982fdbf",
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
"binary/hexadecimal.md": "c3d485f1fd869fe600334ecbef7d5d70",
"binary/index.md": "9089c6f0e86a0727cd03984f51350de0",
"_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
"c/types.md": "cf3e66e5aee58a94db3fdf0783908555",
"logic/quantification.md": "346ebe70e1fad9d95d81056ec9029793",
"logic/quantification.md": "df25c9b73548438f010f450e3755d030",
"c/declarations.md": "2de27f565d1020819008ae80593af435",
"algorithms/sorting/bubble-sort.md": "a350fb36d1e677659142bf38f7abc89b",
"algorithms/sorting/bubble-sort.md": "0762175a4ba183fc7ed5b47758614197",
"_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
"_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"_journal/2024-02/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
@ -170,16 +174,16 @@
"_journal/2024-02/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-02/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
"_journal/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
"binary/endianness.md": "1c579ea9106ec6b9c756608118a1f34d",
"logic/normal-form.md": "f8fd5ea205dfb7e331356b0574f0fe14",
"binary/endianness.md": "63117fe7795e2a10cb2eb7843a089d9d",
"logic/normal-form.md": "6fa46165cbbed5d312e0621f98d21f55",
"_journal/2024-02-12.md": "240d17f356305de9c0c00282b2931acd",
"_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
"encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71",
"encoding/ascii.md": "34350e7b5a4109bcd21f9f411fda0dbe",
"encoding/index.md": "071cfa6a5152efeda127b684f420d438",
"c/strings.md": "aba6e449906d05aee98e3e536eb43742",
"logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f",
"logic/short-circuit.md": "e088e62ead26779f9a51dfd1caeeb9d4",
"logic/boolean-algebra.md": "ef381cb4a991d4d36fa44663a85e7927",
"logic/truth-tables.md": "3587646293a1f6646ed65541bc0a26f4",
"logic/short-circuit.md": "a3fb33603a38a6d3b268556dcbdfa797",
"logic/boolean-algebra.md": "e27c23ed7e924ef574e3be889809fa97",
"_journal/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0",
"_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44",
"binary/shifts.md": "9bbeef29e98c3ab521f44b87528cf5c2",
@ -189,36 +193,36 @@
"_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520",
"_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db",
"_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed",
"algebra/floor-ceiling.md": "556406772daaa415d546b1a8bf41b5dd",
"algebra/floor-ceiling.md": "9e088326fa53684c75fae45e09b0d251",
"algebra/index.md": "90b842eb694938d87c7c68779a5cacd1",
"algorithms/binary-search.md": "f88a5b9f38f1856f2bd4f578d6079548",
"algorithms/binary-search.md": "8533a05ea372e007ab4e8a36fd2772a9",
"_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
"_journal/2024-02/2024-02-16.md": "e701902e369ec53098fc2deed4ec14fd",
"binary/integer-encoding.md": "7ace6ab6c5a4191ae0abdfe7e5abb6a2",
"combinatorics/index.md": "477bfcad2d88edfb823072b8afb9d236",
"combinatorics/index.md": "66efa649c4c87e58fc82c2199096ade4",
"_journal/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
"_journal/2024-02/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
"combinatorics/multiplicative-principle.md": "f1430302e0a35b863fa965a834c4e40a",
"combinatorics/additive-principle.md": "e968028670f95ee9a7c5499ff7cb6792",
"combinatorics/multiplicative-principle.md": "14193048d2f8947cfc4082678bba6c50",
"combinatorics/additive-principle.md": "d036ac511e382d5c1caca437341a5915",
"_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a",
"_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
"combinatorics/permutations.md": "19fd719c756040b31b7aea9595d9fb54",
"combinatorics/combinations.md": "a6a05717313bfcde5365691bca7c35d3",
"combinatorics/permutations.md": "1b994b48798699655ee64df29c640251",
"combinatorics/combinations.md": "8185794feca605d43d6fbf5c929a835e",
"_journal/2024-02-20.md": "b85ba0eeeb16e30a602ccefabcc9763e",
"_journal/2024-02/2024-02-19.md": "df1a9ab7ab89244021b3003c84640c78",
"combinatorics/inclusion-exclusion.md": "202a60120d451676d44df4d0be30a45a",
"combinatorics/inclusion-exclusion.md": "c27b49ee03cc5ee854d0e8bd12a1d505",
"_journal/2024-02-21.md": "b9d944ecebe625da5dd72aeea6a916a2",
"_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841",
"algebra/radices.md": "0a7c37531c6ae4406e1c9e894166ffbe",
"algebra/radices.md": "56919586bfbbb96c53ac12924bdb04b1",
"_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a",
"_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7",
"_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd",
"_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b",
"c17/strings.md": "3cedaa7a28f779e24c2665c7afdcf19a",
"c17/strings.md": "617821357921374bdb6db10f8c2f91ef",
"c17/index.md": "78576ee41d0185df82c59999142f4edb",
"c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500",
"c17/declarations.md": "cec6866dff8ad160467df62cfceb6872",
"algorithms/sorting/merge-sort.md": "a04394c72bd35bd84fe796bbc8ed1a0a",
"c17/declarations.md": "f55d31e93e67f03577300d9e92129e82",
"algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd",
"_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4",
"_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7",
"_journal/2024-02-25.md": "fb1a48208c11d12262facc647749ca6f",
@ -230,28 +234,28 @@
"_journal/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-02/2024-02-27.md": "f75a0d04a875aeee932343dae0c78768",
"filesystems/index.md": "cbd2b0290a3ba3b32abec4bd8bfefad5",
"filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa",
"git/objects.md": "43d825371e820802f2402034fad89480",
"filesystems/cas.md": "d41c0d2e943adecbadd10a03fd1e4274",
"git/objects.md": "c6b7e6a26666386790d25d4ece38175d",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"encoding/integer.md": "d4866b6e236c3a67631d03582996eca2",
"encoding/integer.md": "8b7927d66439d2bdc4a9e50d6e43d9c7",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
"_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe",
"_journal/2024-02/2024-02-29.md": "0e502a2c8baf90c2f12859b03f10b5a1",
"algebra/sequences.md": "97c217823aacf8910a1a37bde694ecfe",
"algebra/sequences/index.md": "d668df1467c7cc70691aeb1d9b17e39d",
"algebra/sequences/index.md": "91ec81d3aa22d1baef2ab4b24736c43c",
"_journal/2024-03-02.md": "08c3cae1df0079293b47e1e9556f1ce1",
"_journal/2024-03/2024-03-01.md": "70da812300f284df72718dd32fc39322",
"algebra/sequences/triangular-numbers.md": "dc3707088423708f2d55708d8b11f81f",
"algebra/sequences/square-numbers.md": "886fb22fb8dbfffdd2cd233558ea3424",
"algebra/sequences/triangular-numbers.md": "3623bebc476635cc7f5a3855221e1e31",
"algebra/sequences/square-numbers.md": "171f7c5a8dac088afba40923ab86c68e",
"_journal/2024-03-03.md": "c4977a3778ed227b768c3f9ad5512670",
"_journal/2024-03/2024-03-02.md": "8136792b0ee6e08232e4f60c88d461d2",
"_journal/2024-03-04.md": "9ec052061e7a613ff877a4488576e82f",
"_journal/2024-03/2024-03-03.md": "64e2f17b4d57a6bd42a3d1b7f2851b83",
"_journal/2024-03-05.md": "e9a911c19bb4c0ff451db793248cb4bb",
"_journal/2024-03/2024-03-04.md": "4948d90a08af2cff58c629c9a2e11ee4",
"algebra/sequences/geometric.md": "3cf58281df1d72bdd853eab4d24d75f2",
"algebra/sequences/arithmetic.md": "5ac02c9a08962dd816e4c4a53761e602",
"algebra/sequences/geometric.md": "57544cab59f0b8c28d4a11f0273a3119",
"algebra/sequences/arithmetic.md": "0e8d8168f04550cb506a218b298c1c7f",
"_journal/2024-03-06.md": "ac7a3d764934f49b2be7aa76e402d853",
"_journal/2024-03/2024-03-05.md": "94b28d0b9bc62cc0bd99d315fb7c6d30",
"_journal/2024-03-07.md": "7bf68d6d81e89aa00f5ddd7510b69e3e",
@ -278,12 +282,12 @@
"_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39",
"_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7",
"_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0",
"encoding/floating-point.md": "83c663e3ecc51498968010d1931bd794",
"encoding/floating-point.md": "812c4da23a30b9c2a4a38bc5c7d40185",
"_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f",
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
"set/index.md": "b82a215fbee3c576186fc1af93c82fcb",
"set/graphs.md": "82c4938f9f6479c75d946c8e1263a5a1",
"set/graphs.md": "bffffb0caee44f403130edbc1753e803",
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
"_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391",
"awk/variables.md": "e40a20545358228319f789243d8b9f77",
@ -295,14 +299,18 @@
"posix/awk/regexp.md": "46ceac3d5225ea3f3a375d74c2e2e0e9",
"posix/awk/index.md": "cac4a1db94f9fc39c5e63ff6994b76aa",
"x86-64/assembly.md": "6c4905468f3936ae260b281e2acd7ffc",
"x86-64/index.md": "4769ab45ca374c4225c9c4099220be82",
"x86-64/index.md": "db0441c243487fc070837596351ba34a",
"_journal/2024-03-21.md": "a2572d2d5be0ee7c7f066d846e2f3e77",
"_journal/2024-03/2024-03-20.md": "0a73ce399d275fe6ee3134a812f3f4f9",
"_journal/2024-03-22.md": "8da8cda07d3de74f7130981a05dce254",
"_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3",
"x86-64/declarations.md": "60f5b240ea5565b33dc3585169fc41b1",
"x86-64/instructions.md": "c4b116179d2bd1f9510437e000f9c63d",
"git/refs.md": "de99450b5a4282ae1a694492f2b7f251"
"x86-64/declarations.md": "8efbeca5fa347571f5c3502afc3a6807",
"x86-64/instructions.md": "240b4ceddf174f48207ba6bed4d25246",
"git/refs.md": "954fc69004aa65b358ec5ce07c1435ce",
"set/trees.md": "56ef76493abcbfdb0256a54dc2d72ba3",
"_journal/2024-03-24.md": "f70f3ae6c75eab485c993869f0e6ffbd",
"_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b",
"_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9"
},
"fields_dict": {
"Basic": [

View File

@ -0,0 +1,11 @@
---
title: "2024-03-24"
---
- [ ] Anki Flashcards
- [x] 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)

View File

@ -8,7 +8,9 @@ title: "2024-03-22"
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
- [x] Log Work Hours (Max 3 hours)
* Reach section 3.3 of "Computer Systems: A Programmer's Perspective".
* Basic [[x86-64/declarations|Intel data types]] and historical context around their naming.
* Basic [[x86-64/declarations|Intel data types]] and historical context around their naming.
* Added flashcards on [[trees]].
* Read chapter 5 "Replication" of "Designing Data-Intensive Applications".

View File

@ -0,0 +1,18 @@
---
title: "2024-03-23"
---
- [x] Anki Flashcards
- [x] 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)
* Spent most of the day building out a first prototype for a hide-and-seek app.
* Loaded geometry in an Ecto-compatible way.
* Rendered Mapbox map and drew regions as well as current location.
* Next steps:
* Let multiple people connect and share connection status.
* Have a shared hiding timer and search timer.

View File

@ -1,5 +1,5 @@
---
title: Combinatorics
title: Multiplicative Principle
TARGET DECK: Obsidian::STEM
FILE TAGS: combinatorics set
tags:

View File

@ -580,7 +580,7 @@ END%%
%%ANKI
Basic
What identifier is guaranteed to not occur freely in $E_e^x$?
Back: None.
Back: N/A.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1707937867036-->
END%%

View File

@ -543,7 +543,7 @@ END%%
Basic
What is the in-degree of vertex $5$?
![[directed-graph-example.png]]
Back: $2$.
Back: $2$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1710796091064-->
END%%
@ -552,7 +552,7 @@ END%%
Basic
What is the out-degree of vertex $5$?
![[directed-graph-example.png]]
Back: $1$.
Back: $1$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1710796091071-->
END%%
@ -798,7 +798,7 @@ END%%
%%ANKI
Basic
What path must exist if vertex $u$ is adjacent to vertex $v$?
What path must exist in a digraph where vertex $u$ is adjacent to vertex $v$?
Back: $\langle v, u \rangle$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1710807788383-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
notes/set/images/forest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

601
notes/set/trees.md Normal file
View File

@ -0,0 +1,601 @@
---
title: Trees
TARGET DECK: Obsidian::STEM
FILE TAGS: set::graph
tags:
- graph
- set
---
## Overview
A **free tree** is a connected, acyclic, undirected [[graphs|graph]]. If an undirected graph is acyclic but possibly disconnected, it is a **forest**.
%%ANKI
Basic
What is a free tree?
Back: A connected, acyclic, undirected graph.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844897-->
END%%
%%ANKI
Basic
What is a forest?
Back: An acyclic undirected graph.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844903-->
END%%
%%ANKI
Basic
What additional property must an undirected graph exhibit to be a forest?
Back: It must be acyclic.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844906-->
END%%
%%ANKI
Basic
What additional properties must an undirected graph exhibit to be a free tree?
Back: It must be acyclic and connected.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844909-->
END%%
%%ANKI
Basic
What additional properties must a forest exhibit to be a free tree?
Back: It must be connected.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844912-->
END%%
%%ANKI
Basic
What additional properties must a free tree exhibit to be a forest?
Back: N/A
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844915-->
END%%
%%ANKI
Basic
If the following isn't a free tree, why not?
![[free-tree.png]]
Back: N/A
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844918-->
END%%
%%ANKI
Basic
If the following isn't a free tree, why not?
![[forest.png]]
Back: Because it is disconnected.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844922-->
END%%
%%ANKI
Basic
If the following isn't a free tree, why not?
![[cyclic-undirected.png]]
Back: Because it contains a cycle.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844926-->
END%%
%%ANKI
Basic
If the following isn't a forest, why not?
![[free-tree.png]]
Back: N/A
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844930-->
END%%
%%ANKI
Basic
If the following isn't a forest, why not?
![[forest.png]]
Back: N/A
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844934-->
END%%
%%ANKI
Basic
If the following isn't a forest, why not?
![[cyclic-undirected.png]]
Back: Because it contains a cycle.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844939-->
END%%
%%ANKI
Basic
How do free trees pictorially relate to forests?
Back: A forest is drawn as one or more free trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844943-->
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**.
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**.
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 simple 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 simple path from the node to a leaf.
%%ANKI
Basic
What is a rooted tree?
Back: A free tree in which one of the vertices is distinguished from the others.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844947-->
END%%
%%ANKI
Basic
Is every rooted tree a free tree?
Back: Yes.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844951-->
END%%
%%ANKI
Basic
Is every free tree a rooted tree?
Back: No.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844955-->
END%%
%%ANKI
Basic
Which free trees are not considered rooted trees?
Back: Those without some vertex identified as the root.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844958-->
END%%
%%ANKI
Basic
What distinguishes a node from a vertex?
Back: A node is a vertex of a rooted tree.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844962-->
END%%
%%ANKI
Basic
Is every vertex a node?
Back: No.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844966-->
END%%
%%ANKI
Basic
Is every node a vertex?
Back: Yes.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844969-->
END%%
%%ANKI
Cloze
{Nodes} are to rooted trees whereas {vertices} are to free trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844973-->
END%%
%%ANKI
Basic
Which of free trees or rooted trees is a more general concept?
Back: Free trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844976-->
END%%
%%ANKI
Basic
What does it mean for node $y$ to be an ancestor of node $x$ in a rooted tree?
Back: $y$ is in the simple path from the root to $x$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844980-->
END%%
%%ANKI
Basic
What does it mean for node $y$ to be a descendent of node $x$ in a rooted tree?
Back: $x$ is in the simple path from the root to $y$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844983-->
END%%
%%ANKI
Cloze
In a rooted tree, if $y$ is an {ancestor} of $x$, then $x$ is a {descendant} of $y$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844986-->
END%%
%%ANKI
Basic
What are the ancestors of a rooted tree's root?
Back: Just the root itself.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844989-->
END%%
%%ANKI
Basic
What are the descendants of a rooted tree's root?
Back: Every node in the tree.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844993-->
END%%
%%ANKI
Basic
What are the proper ancestors of a rooted tree's root?
Back: There are none.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136844996-->
END%%
%%ANKI
Basic
What are the proper descendants of a rooted tree's root?
Back: Every node but the root.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845000-->
END%%
%%ANKI
Basic
What does it mean for node $y$ to be a child of node $x$ in a rooted tree?
Back: There exists a path from the root to $y$ such that the last edge is $\{x, y\}$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845004-->
END%%
%%ANKI
Basic
What does it mean for node $y$ to be a parent of node $x$ in a rooted tree?
Back: There exists a path from the root to $x$ such that the last edge is $\{y, x\}$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845009-->
END%%
%%ANKI
Basic
In a rooted tree, how does the concept of "ancestor" relate to "parent"?
Back: Ancestors include parents, parents of parents, etc.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845015-->
END%%
%%ANKI
Basic
In a rooted tree, how does the concept of "descendants" relate to "child"?
Back: Descendants include children, children of children, etc.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845020-->
END%%
%%ANKI
Basic
In a rooted tree, how many ancestors does a node have?
Back: At least one (i.e. itself).
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845026-->
END%%
%%ANKI
Basic
In a rooted tree, how many parents does a node have?
Back: Zero or one.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845031-->
END%%
%%ANKI
Basic
In a rooted tree, how many descendants does a node have?
Back: At least one (i.e. itself).
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845037-->
END%%
%%ANKI
Basic
In a rooted tree, how many children does a node have?
Back: Zero or more.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845044-->
END%%
%%ANKI
Basic
Which nodes in a rooted tree has no parent?
Back: Just the root.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845051-->
END%%
%%ANKI
Basic
In a rooted tree, what are siblings?
Back: Nodes that have the same parent.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845057-->
END%%
%%ANKI
Basic
In a rooted tree, what is an external node?
Back: A node with no children.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845063-->
END%%
%%ANKI
Basic
In a rooted tree, what alternative term is used in favor of "external node"?
Back: A leaf.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845072-->
END%%
%%ANKI
Basic
In a rooted tree, what is an internal node?
Back: A node with at least one child.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845079-->
END%%
%%ANKI
Basic
In a rooted tree, what alternative term is used in favor of "internal node"?
Back: A nonleaf.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845087-->
END%%
%%ANKI
Cloze
{1:External} nodes are to {2:leaf} nodes whereas {2:internal} nodes are to {1:nonleaf} nodes.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845093-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree. What does the degree of a node refer to?
Back: The number of children that node has.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845101-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree. What does the depth of a node refer to?
Back: The length of the simple path from the root to the node.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845107-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree. What does a level refer to?
Back: All nodes in $T$ that have the same depth.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845114-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree. What does the height of a node refer to?
Back: The length of the longest simple path from said node to a leaf.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845119-->
END%%
%%ANKI
Basic
What is the height of a rooted tree in terms of "height"?
Back: The height of its root.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845124-->
END%%
%%ANKI
Basic
What is the height of a rooted tree in terms of "depth"?
Back: The largest depth of any node in the tree.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845131-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree of height $h$. Which nodes have height $0$?
Back: The external nodes.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845137-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree of height $h$. Which nodes have height $h$?
Back: The root node.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845141-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree of height $h$. Which nodes have depth $0$?
Back: The root.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845145-->
END%%
%%ANKI
Basic
Let $T$ be a rooted tree of height $h$. Which nodes have depth $h$?
Back: The external nodes.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845150-->
END%%
%%ANKI
Basic
What is the height of this rooted tree?
![[rooted-tree.png]]
Back: $4$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845156-->
END%%
%%ANKI
Basic
What is the height of node $4$ in the following rooted tree?
![[rooted-tree.png]]
Back: $1$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845164-->
END%%
%%ANKI
Basic
What is the depth of node $11$ in the following rooted tree?
![[rooted-tree.png]]
Back: $2$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845172-->
END%%
%%ANKI
Basic
Which node has the largest depth in the following rooted tree?
![[rooted-tree.png]]
Back: $9$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845178-->
END%%
%%ANKI
Basic
Which node has the largest height in the following rooted tree?
![[rooted-tree.png]]
Back: $7$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845184-->
END%%
%%ANKI
Basic
Which nodes are on level $3$ in the following rooted tree?
![[rooted-tree.png]]
Back: $1$, $6$, and $5$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845191-->
END%%
%%ANKI
Basic
Which level has the most nodes in the following rooted tree?
![[rooted-tree.png]]
Back: The second level.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845198-->
END%%
%%ANKI
Basic
Which nodes have depth corresponding to this rooted tree's height?
![[rooted-tree.png]]
Back: $9$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845205-->
END%%
%%ANKI
Basic
Which nodes have the most siblings in the following rooted tree?
![[rooted-tree.png]]
Back: $3$, $10$, and $4$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845210-->
END%%
%%ANKI
Basic
Which nodes are ancestors to $12$ in the following rooted tree?
![[rooted-tree.png]]
Back: $12$, $3$, and $7$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845214-->
END%%
%%ANKI
Basic
Which nodes are descendants to $4$ in the following rooted tree?
![[rooted-tree.png]]
Back: $4$, $11$, and $2$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845219-->
END%%
%%ANKI
Basic
Which nodes are parents of $6$ in the following rooted tree?
![[rooted-tree.png]]
Back: $8$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845223-->
END%%
%%ANKI
Basic
Which nodes are children of $7$ in the following rooted tree?
![[rooted-tree.png]]
Back: $3$, $10$, and $4$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845227-->
END%%
%%ANKI
Basic
What are the internal nodes of the following rooted tree?
![[rooted-tree.png]]
Back: $7$, $3$, $4$, $12$, $8$, and $5$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845231-->
END%%
%%ANKI
Basic
What are the external nodes of the following rooted tree?
![[rooted-tree.png]]
Back: $10$, $11$, $2$, $1$, $6$, and $9$.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845235-->
END%%
%%ANKI
Basic
What level does node $6$ reside on in the following rooted tree?
![[rooted-tree.png]]
Back: $3$
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845240-->
END%%
## Bibliography
* Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).