Ordered/binary trees.

c-declarations
Joshua Potter 2024-04-14 11:58:01 -06:00
parent 1e48d1388c
commit f3b59d77f6
25 changed files with 447 additions and 33 deletions

View File

@ -106,12 +106,15 @@
"free-tree.png", "free-tree.png",
"forest.png", "forest.png",
"cyclic-undirected.png", "cyclic-undirected.png",
"rooted-tree.png" "rooted-tree.png",
"ordered-rooted-tree.png",
"ordered-rooted-tree-cmp.png",
"ordered-binary-tree-cmp.png"
], ],
"File Hashes": { "File Hashes": {
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
"algorithms/sorting/index.md": "4a66e28bce754de5df31ec2f4aed7e93", "algorithms/sorting/index.md": "4a66e28bce754de5df31ec2f4aed7e93",
"algorithms/sorting/insertion-sort.md": "b352f91800ab87e60c58dbfaf3ae959e", "algorithms/sorting/insertion-sort.md": "656c9f13dadb8dd663701ff673dd0ee1",
"bash/index.md": "22083ea1ee9505cc96b02f82f63ba2c9", "bash/index.md": "22083ea1ee9505cc96b02f82f63ba2c9",
"bash/prompts.md": "cc51c210fa819338d4e95658955173df", "bash/prompts.md": "cc51c210fa819338d4e95658955173df",
"bash/quoting.md": "b1d8869a91001f8b22f0cdc54d806f61", "bash/quoting.md": "b1d8869a91001f8b22f0cdc54d806f61",
@ -145,7 +148,7 @@
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180", "_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb", "_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", "_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"logic/equiv-trans.md": "00c899a0a6a868a580a19cb11c416997", "logic/equiv-trans.md": "1198fbea260527e7dfd17b72955f5bee",
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889", "_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9", "algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9",
@ -160,7 +163,7 @@
"c/types.md": "cf3e66e5aee58a94db3fdf0783908555", "c/types.md": "cf3e66e5aee58a94db3fdf0783908555",
"logic/quantification.md": "df25c9b73548438f010f450e3755d030", "logic/quantification.md": "df25c9b73548438f010f450e3755d030",
"c/declarations.md": "2de27f565d1020819008ae80593af435", "c/declarations.md": "2de27f565d1020819008ae80593af435",
"algorithms/sorting/bubble-sort.md": "0762175a4ba183fc7ed5b47758614197", "algorithms/sorting/bubble-sort.md": "ed480530146aabe122f4dbf00cdacb09",
"_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f", "_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
"_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", "_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"_journal/2024-02/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109", "_journal/2024-02/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
@ -183,7 +186,7 @@
"c/strings.md": "aba6e449906d05aee98e3e536eb43742", "c/strings.md": "aba6e449906d05aee98e3e536eb43742",
"logic/truth-tables.md": "3587646293a1f6646ed65541bc0a26f4", "logic/truth-tables.md": "3587646293a1f6646ed65541bc0a26f4",
"logic/short-circuit.md": "a3fb33603a38a6d3b268556dcbdfa797", "logic/short-circuit.md": "a3fb33603a38a6d3b268556dcbdfa797",
"logic/boolean-algebra.md": "e27c23ed7e924ef574e3be889809fa97", "logic/boolean-algebra.md": "56d2e0be2853d49b5dface7fa2d785a9",
"_journal/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0", "_journal/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0",
"_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44", "_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44",
"binary/shifts.md": "9bbeef29e98c3ab521f44b87528cf5c2", "binary/shifts.md": "9bbeef29e98c3ab521f44b87528cf5c2",
@ -193,7 +196,7 @@
"_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520", "_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520",
"_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db", "_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db",
"_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed", "_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed",
"algebra/floor-ceiling.md": "9e088326fa53684c75fae45e09b0d251", "algebra/floor-ceiling.md": "ffffdd893398da842be2e4337c16bbf7",
"algebra/index.md": "90b842eb694938d87c7c68779a5cacd1", "algebra/index.md": "90b842eb694938d87c7c68779a5cacd1",
"algorithms/binary-search.md": "8533a05ea372e007ab4e8a36fd2772a9", "algorithms/binary-search.md": "8533a05ea372e007ab4e8a36fd2772a9",
"_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048", "_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
@ -207,7 +210,7 @@
"_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a", "_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a",
"_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629", "_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
"combinatorics/permutations.md": "1b994b48798699655ee64df29c640251", "combinatorics/permutations.md": "1b994b48798699655ee64df29c640251",
"combinatorics/combinations.md": "8185794feca605d43d6fbf5c929a835e", "combinatorics/combinations.md": "b83f325caa1a7a97a3873016d6ccefcc",
"_journal/2024-02-20.md": "b85ba0eeeb16e30a602ccefabcc9763e", "_journal/2024-02-20.md": "b85ba0eeeb16e30a602ccefabcc9763e",
"_journal/2024-02/2024-02-19.md": "df1a9ab7ab89244021b3003c84640c78", "_journal/2024-02/2024-02-19.md": "df1a9ab7ab89244021b3003c84640c78",
"combinatorics/inclusion-exclusion.md": "c27b49ee03cc5ee854d0e8bd12a1d505", "combinatorics/inclusion-exclusion.md": "c27b49ee03cc5ee854d0e8bd12a1d505",
@ -218,7 +221,7 @@
"_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7", "_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7",
"_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd", "_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd",
"_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b", "_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b",
"c17/strings.md": "c0893d2eb34f43484af81b3c3d3835ed", "c17/strings.md": "e4012ee9a18ad44370490e375ae57f09",
"c17/index.md": "78576ee41d0185df82c59999142f4edb", "c17/index.md": "78576ee41d0185df82c59999142f4edb",
"c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500", "c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500",
"c17/declarations.md": "f55d31e93e67f03577300d9e92129e82", "c17/declarations.md": "f55d31e93e67f03577300d9e92129e82",
@ -237,7 +240,7 @@
"filesystems/cas.md": "d41c0d2e943adecbadd10a03fd1e4274", "filesystems/cas.md": "d41c0d2e943adecbadd10a03fd1e4274",
"git/objects.md": "c6b7e6a26666386790d25d4ece38175d", "git/objects.md": "c6b7e6a26666386790d25d4ece38175d",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15", "git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"encoding/integer.md": "8b7927d66439d2bdc4a9e50d6e43d9c7", "encoding/integer.md": "13f5cb33721bc0815d95821ef940321b",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508", "_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
"_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82", "_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe", "_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe",
@ -282,12 +285,12 @@
"_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39", "_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39",
"_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7", "_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7",
"_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0", "_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0",
"encoding/floating-point.md": "812c4da23a30b9c2a4a38bc5c7d40185", "encoding/floating-point.md": "bcb08f08d4ab63cd651b785b343a4b58",
"_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f", "_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f",
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
"set/index.md": "b82a215fbee3c576186fc1af93c82fcb", "set/index.md": "b82a215fbee3c576186fc1af93c82fcb",
"set/graphs.md": "b2651abacb583dc21292da3dbe422179", "set/graphs.md": "7e03faf8fce1168db7a8fcebb396b47f",
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
"_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391", "_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391",
"awk/variables.md": "e40a20545358228319f789243d8b9f77", "awk/variables.md": "e40a20545358228319f789243d8b9f77",
@ -307,7 +310,7 @@
"x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2", "x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2",
"x86-64/instructions.md": "240b4ceddf174f48207ba6bed4d25246", "x86-64/instructions.md": "240b4ceddf174f48207ba6bed4d25246",
"git/refs.md": "954fc69004aa65b358ec5ce07c1435ce", "git/refs.md": "954fc69004aa65b358ec5ce07c1435ce",
"set/trees.md": "d25bd5b839fd961f99c54526a827fa4d", "set/trees.md": "fd092c77c26d0b99b3131da6dc043edd",
"_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6", "_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6",
"_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b", "_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b",
"_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9", "_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9",
@ -319,7 +322,25 @@
"_journal/2024-03/2024-03-27.md": "42cb4031f290972be2a43172e80b280a", "_journal/2024-03/2024-03-27.md": "42cb4031f290972be2a43172e80b280a",
"_journal/2024-03/2024-03-26.md": "c21d80f07a8056a5a0a31ade8f2f6f65", "_journal/2024-03/2024-03-26.md": "c21d80f07a8056a5a0a31ade8f2f6f65",
"_journal/2024-03-29.md": "714957f5f770ff79ff011b4fa6f44cd6", "_journal/2024-03-29.md": "714957f5f770ff79ff011b4fa6f44cd6",
"_journal/2024-03/2024-03-28.md": "95f213c78825abf4a2d8c75dce59688e" "_journal/2024-03/2024-03-28.md": "95f213c78825abf4a2d8c75dce59688e",
"_journal/2024-04-05.md": "e8cc9071509acf5a84b2c08ebe8c4249",
"_journal/2024-04/2024-04-04.md": "f9177edb94c66ac09675bd755f041ec5",
"_journal/2024-04/2024-04-03.md": "f1057f16e0e36d47032a81222044f166",
"_journal/2024-04/2024-04-02.md": "53bc3a2bc827a77f94edd2b0ac66b525",
"_journal/2024-04/2024-04-01.md": "fbbd652bb2e9fa6341be6aefcc633f3e",
"_journal/2024-03/2024-03-31.md": "5f1499a7e08505975760054c13bd5f00",
"_journal/2024-03/2024-03-30.md": "d1011fab509f4b8ad3b1132dc6a311cb",
"_journal/2024-03/2024-03-29.md": "45d60952781bb59e736d8d9125b8d3f8",
"_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-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"
}, },
"fields_dict": { "fields_dict": {
"Basic": [ "Basic": [

View File

@ -0,0 +1,11 @@
---
title: "2024-04-13"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)

View File

@ -0,0 +1,14 @@
---
title: "2024-04-04"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Back home from Pranav's.
* Refined the hide and seek application further. Instead of relying on Presence as much as I have, just keep player state directly on the GenServer I already have running. This has simplified the logic significantly.

View File

@ -0,0 +1,16 @@
---
title: "2024-04-05"
---
- [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)
* More hide and seek work:
* Bootstrap room servers on application start and restart on failure.
* Keep room on disk in sync with room in memory.
* Get phase timers implemented.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-06"
---
- [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)
* Continue adding more flashcards around trees (ordered and binary).
* Refactor the hide and seek application into a more functional/pipeline style.

View File

@ -0,0 +1,13 @@
---
title: "2024-04-07"
---
- [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)
* Met with Gus and Addie on feedback for hide-and-seek project.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-08"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Continued working on hide-and-seek application.
* Mostly mapbox-related functionality.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-09"
---
- [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)
* Continued working on hide-and-seek application.
* Decided at this point we should switch off of live views. Considering we want to eventually add mobile support, live views aren't compatible. We might as well have the web application work similarly. It will be a fairly large refactor, but I'd like to get it done before this weekend's playtest.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-10"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Hide & Seek
* Begun the refactoring away from Phoenix LiveViews to React.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-11"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Hide-and-seek application
* Mad dash to get something more or less functional for Saturday's playtest. Definitely not solid code but something I can begin cleaning up properly after, once we are satisfied with the flow of the game state machine.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-12"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Hide and Seek
* Finished getting a basic prototype up and running. Hosted on https://hideandseek.live.

View File

@ -125,7 +125,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What C operator corresponds to floor division? What C operator corresponds to floor division?
Back: None. Back: N/A.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1708110779699--> <!--ID: 1708110779699-->
END%% END%%

View File

@ -79,7 +79,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is `BUBBLE_SORT` in place? Is `BUBBLE_SORT` in place?
Back: Yes Back: Yes.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1707504634789--> <!--ID: 1707504634789-->
END%% END%%
@ -87,7 +87,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is `BUBBLE_SORT` stable? Is `BUBBLE_SORT` stable?
Back: Yes Back: Yes.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1707504634791--> <!--ID: 1707504634791-->
END%% END%%
@ -95,7 +95,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is `BUBBLE_SORT` adaptive? Is `BUBBLE_SORT` adaptive?
Back: Yes Back: Yes.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1707504634792--> <!--ID: 1707504634792-->
END%% END%%

View File

@ -71,7 +71,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is `INSERTION_SORT` in place? Is `INSERTION_SORT` in place?
Back: Yes Back: Yes.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1706926586955--> <!--ID: 1706926586955-->
END%% END%%
@ -79,7 +79,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is `INSERTION_SORT` stable? Is `INSERTION_SORT` stable?
Back: Yes Back: Yes.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1706926586959--> <!--ID: 1706926586959-->
END%% END%%
@ -87,7 +87,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is `INSERTION_SORT` adaptive? Is `INSERTION_SORT` adaptive?
Back: Yes Back: Yes.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1707504634779--> <!--ID: 1707504634779-->
END%% END%%

View File

@ -782,6 +782,24 @@ Tags: printf
<!--ID: 1710599806331--> <!--ID: 1710599806331-->
END%% END%%
%%ANKI
Basic
What is the output of `printf("%.1f", 2.0)`?
Back: `2.0`
Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962).
Tags: printf
<!--ID: 1712836989972-->
END%%
%%ANKI
Basic
Assuming fixed-point notation, what is the output of `printf("%.1g", 2.0)`?
Back: `2`
Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962).
Tags: printf
<!--ID: 1712836989975-->
END%%
%%ANKI %%ANKI
Basic Basic
Assuming fixed-point notation, what is the output of `printf("%g", 3.14)`? Assuming fixed-point notation, what is the output of `printf("%g", 3.14)`?

View File

@ -111,7 +111,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What combinatorial concept explains the number of subsets of a finite set? What combinatorial concept explains the number of subsets of a finite set of a given size?
Back: Combinations. Back: Combinations.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1708368078717--> <!--ID: 1708368078717-->

View File

@ -362,7 +362,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What range of values does the significand $M$ take on in IEEE floating-point? What range of values does the significand $M$ take on in IEEE floating-point?
Back: Between $1$ and $2 - \epsilon$ or between $0$ and $1 - \epsilon$. Back: Between $0$ and $2 - \epsilon$.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710556915012--> <!--ID: 1710556915012-->
END%% END%%
@ -503,6 +503,24 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
<!--ID: 1710556915044--> <!--ID: 1710556915044-->
END%% END%%
%%ANKI
Basic
What is the binary representation of a `float`'s bias?
Back: `01111111`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1712938082200-->
END%%
%%ANKI
Basic
What is the binary representation of a `double`'s bias?
Back: `01111111111`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1712938082205-->
END%%
%%ANKI %%ANKI
Basic Basic
How do you determine the exponent *value* in normalized form? How do you determine the exponent *value* in normalized form?

View File

@ -96,7 +96,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
According to the C standard, Is `unsigned` overflow well-defined? According to the C standard, Is `unsigned` overflow well-defined?
Back: Yes Back: Yes.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1708551236389--> <!--ID: 1708551236389-->
END%% END%%
@ -104,7 +104,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
According to the C standard, Is `signed` overflow well-defined? According to the C standard, Is `signed` overflow well-defined?
Back: No Back: No.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1708551236392--> <!--ID: 1708551236392-->
END%% END%%

View File

@ -55,7 +55,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What C logical operator corresponds to $\land$? What C logical operator corresponds to $\land$?
Back: There isn't one. Back: N/A
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
Tags: c17 Tags: c17
<!--ID: 1706994861327--> <!--ID: 1706994861327-->
@ -64,7 +64,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What C logical operator corresponds to $\lor$? What C logical operator corresponds to $\lor$?
Back: There isn't one. Back: N/A
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
Tags: c17 Tags: c17
<!--ID: 1706994861329--> <!--ID: 1706994861329-->
@ -73,7 +73,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What C logical operator corresponds to $\Rightarrow$? What C logical operator corresponds to $\Rightarrow$?
Back: There isn't one. Back: N/A
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
Tags: c17 Tags: c17
<!--ID: 1706994861331--> <!--ID: 1706994861331-->

View File

@ -67,7 +67,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is $(b \land c)$ well-defined in $\{(b, T), (c, F)\}$? Is $(b \land c)$ well-defined in $\{(b, T), (c, F)\}$?
Back: Yes Back: Yes.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1706994861318--> <!--ID: 1706994861318-->
END%% END%%
@ -75,7 +75,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is $(b \lor d)$ well-defined in $\{(b, T), (c, F)\}$? Is $(b \lor d)$ well-defined in $\{(b, T), (c, F)\}$?
Back: No Back: No.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1706994861320--> <!--ID: 1706994861320-->
END%% END%%
@ -588,7 +588,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What identifier is guaranteed to not occur freely in $E_{s(e)}^x$? What identifier is guaranteed to not occur freely in $E_{s(e)}^x$?
Back: $x$. Back: $x$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1707937867039--> <!--ID: 1707937867039-->
END%% END%%

View File

@ -709,7 +709,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What are the paths of length $1$ from vertex $2$ to vertex $2$? What are the paths of length $1$ to vertex $2$?
![[directed-graph-example.png]] ![[directed-graph-example.png]]
Back: $\langle 1, 2 \rangle$, $\langle 2, 2 \rangle$ Back: $\langle 1, 2 \rangle$, $\langle 2, 2 \rangle$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
@ -720,7 +720,7 @@ END%%
Basic Basic
What are the paths of length $2$ from vertex $2$ to vertex $2$? What are the paths of length $2$ from vertex $2$ to vertex $2$?
![[directed-graph-example.png]] ![[directed-graph-example.png]]
Back: $\langle 4, 1, 2 \rangle$, $\langle 2, 2, 2 \rangle$ Back: $\langle 2, 2, 2 \rangle$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1710807788348--> <!--ID: 1710807788348-->
END%% END%%

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -391,7 +391,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Let $T$ be a rooted tree. What does a level refer to? Let $T$ be a rooted tree. What does a level refer to?
Back: All nodes in $T$ that have the same depth. Back: A set of 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). Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711136845114--> <!--ID: 1711136845114-->
END%% END%%
@ -596,6 +596,225 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition
<!--ID: 1711136845240--> <!--ID: 1711136845240-->
END%% END%%
An **ordered tree** is a rooted tree in which the children of each node are ordered.
%%ANKI
Basic
What is an ordered tree?
Back: A rooted tree in which the children of each node are ordered.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712406878904-->
END%%
%%ANKI
Basic
Which of ordered trees or rooted trees is the more general concept?
Back: Rooted trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712406878909-->
END%%
%%ANKI
Basic
Which of free trees or ordered trees is the more general concept?
Back: Free trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712406878912-->
END%%
%%ANKI
Basic
Is every rooted tree an ordered tree?
Back: No.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712406878915-->
END%%
%%ANKI
Basic
Is every ordered tree a rooted tree?
Back: Yes.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712406878917-->
END%%
%%ANKI
Basic
The following two trees are equivalent when considered as what kind of trees?
![[ordered-rooted-tree-cmp.png]]
Back: Rooted/free trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712407152755-->
END%%
%%ANKI
Basic
The following two trees are different when considered as what kind of trees?
![[ordered-rooted-tree-cmp.png]]
Back: Ordered trees.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712407152763-->
END%%
A **binary tree** $T$ is a structure defined on a finite set of nodes that either
* contains no nodes, or
* is composed of three disjoint sets of nodes: a **root** node, a **left subtree**, and a **right subtree**.
%%ANKI
Basic
What is the base case used in the recursive definition of a binary tree?
Back: The empty set.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712409466593-->
END%%
%%ANKI
Basic
What recurrence is used in the recursive definition of a binary tree?
Back: A binary tree is composed of a root node, a left subtree, and a right subtree.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712409466606-->
END%%
%%ANKI
Basic
How should the nil constructor of an inductive binary tree, say `Tree`, be defined?
Back:
```lean
| constructor : Tree α
```
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466615-->
END%%
%%ANKI
Basic
How should the non-nil constructor of an inductive binary tree, say `Tree`, be defined?
Back:
```lean
| constructor : α → Tree α → Tree α → Tree α
```
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466621-->
END%%
%%ANKI
Basic
In the following binary tree type, what name is given to the first argument of `node`?
```lean
inductive Tree α where
| nil : Tree α
| node : α → Tree α → Tree α → Tree α
```
Back: The root node.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466627-->
END%%
%%ANKI
Basic
In the following binary tree type, what name is given to the second argument of `node`?
```lean
inductive Tree α where
| nil : Tree α
| node : α → Tree α → Tree α → Tree α
```
Back: The left subtree.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466634-->
END%%
%%ANKI
Basic
In the following binary tree type, what name is given to the third argument of `node`?
```lean
inductive Tree α where
| nil : Tree α
| node : α → Tree α → Tree α → Tree α
```
Back: The right subtree.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466639-->
END%%
%%ANKI
Basic
Given the following binary tree implementation, how do you construct an empty tree?
```lean
inductive Tree α where
| nil : Tree α
| node : α → Tree α → Tree α → Tree α
```
Back: `nil`
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466643-->
END%%
%%ANKI
Basic
Given the following binary tree implementation, how do you construct a tree with root `a`, left child `b`, and right child `c`?
```lean
inductive Tree α where
| nil : Tree α
| node : α → Tree α → Tree α → Tree α
```
Back: `node 'a' (node 'b' nil nil) (node 'c' nil nil)`
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
Tags: lean
<!--ID: 1712409466648-->
END%%
%%ANKI
Basic
Why isn't a binary tree considered an ordered tree?
Back: A left child is distinct from a right child, even if the child is the same in both cases.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712409466653-->
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).
<!--ID: 1712409466660-->
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).
<!--ID: 1712409466670-->
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).
<!--ID: 1712409466676-->
END%%
%%ANKI
Basic
Why are these two binary trees not the same?
![[ordered-binary-tree-cmp.png]]
Back: `5` is a left child in the first tree but a right child in the second.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1712409466682-->
END%%
## Bibliography ## Bibliography
* Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). * Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).