Basic notes on sorting.

Joshua Potter 2024-02-03 10:29:19 -07:00
parent 52df11cd84
commit 4f5017e3c1
3 changed files with 38 additions and 6 deletions

View File

@ -77,11 +77,11 @@
"logic/index.md": "d41d8cd98f00b204e9800998ecf8427e",
"journal/2024-02-03.md": "1359532c63e14251da04181fb0873d66",
"bash/prompts.md": "61cb877e68da040a15b85af76b1f68ba",
"algorithms/sorting/index.md": "cd189e1a2cf32b5656b16aaf9f488874",
"algorithms/sorting/index.md": "3dea2ae728a19fa2d877711fa319ed87",
"algorithms/sorting/insertion-sort.md": "c78c9983f87cdc4198f82803d418967f",
"algorithms/index.md": "1583c07edea4736db27c38fe2b6c4c31",
"c/escape-sequences.md": "07f0811b0fff14f54f78abc33f2e6606",
"journal/2024-02-03.md": "fca2323a3284ca8cd0a1aea9e354bb80",
"journal/2024-02-03.md": "0c5632b15b5f981bc3efe66c498f8add",
"lua/index.md": "d41d8cd98f00b204e9800998ecf8427e",
"c/index.md": "d41d8cd98f00b204e9800998ecf8427e",
"gawk/variables.md": "4482c297e7f4f5987f42f1926a880ca7",

View File

@ -9,7 +9,36 @@ tags:
## Overview
Let $n \geq 0$ and $S = \langle a_1, a_2, \ldots, a_n \rangle$ be a sequence. The **sorting problem** refers to permuting **keys** $a_1, a_2, \ldots, a_n$ into a new sequence $\langle a_1', a_2', \ldots, a_n' \rangle$ such that $a_1' \leq a_2' \leq \cdots \leq a_n'$.
Let $n \geq 0$. The **sorting problem** refers to permuting **records** $a_1, a_2, \ldots, a_n$ into a new sequence $\langle a_1', a_2', \ldots, a_n' \rangle$ such that $key(a_1') \leq key(a_2') \leq \cdots \leq key(a_n')$.
%%ANKI
Cloze
In the sorting problem, a "{record}" refers to {the entries being sorted}.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1706981319280-->
END%%
%%ANKI
Cloze
In the sorting problem, a "{key}" refers to {the value records are sorted by}.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1706981319310-->
END%%
%%ANKI
Cloze
In the sorting problem, "{satellite data}" refers to {the non-key values of records}.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1706981319317-->
END%%
%%ANKI
Basic
What term does Cormen et al. use to describe the record value used for sorting?
Back: Keys.
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1706981319324-->
END%%
%%ANKI
Basic
@ -26,6 +55,7 @@ Back: One in which only a constant number of input values are ever stored outsid
Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1706925787146-->
END%%
## Structural Comparison
The #Elixir documentation makes a point that there exist two types of comparisons between data types.[^structural] The first is **structural** in which comparisons are made on the underlying data structures used to describe the data types. The second is **semantic** which focuses on making the comparison with respect to what the data types represent.

View File

@ -4,10 +4,12 @@ title: "2024-02-03"
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [x] Sheet Music (10 min.)
- [ ] OGS (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [x] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
* Spent time consolidating how different escape sequences behave across languages (`awk`, Bash, C, and Lua).
* Spent time consolidating how different escape sequences behave across languages (`awk`, Bash, C, and Lua).
* Read 호랑이와 곶감 (The Tiger and the Dried Persimmon).
* Started practicing "One Summer's Day" by Joe Hisaishi, arranged by Torbjørn Brandrud.