From 5f8017ba3d9b57d3e75670000f008fb9755fc7c4 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Sun, 12 May 2024 09:19:27 -0600 Subject: [PATCH] Basic ADTs. --- .../plugins/obsidian-to-anki-plugin/data.json | 31 +++-- notes/_journal/2024-05-12.md | 9 ++ notes/_journal/{ => 2024-05}/2024-05-09.md | 3 +- notes/_journal/2024-05/2024-05-10.md | 13 ++ notes/_journal/2024-05/2024-05-11.md | 12 ++ notes/abstract-data-types/index.md | 21 +++ notes/abstract-data-types/queues.md | 85 ++++++++++++ notes/abstract-data-types/stacks.md | 85 ++++++++++++ notes/algebra/sequences/arithmetic.md | 2 +- notes/combinatorics/combinations.md | 2 +- notes/data-structures/arrays.md | 70 ++++++++++ notes/data-structures/heaps.md | 2 +- .../images/array-1d-col-major.png | Bin 0 -> 4021 bytes .../images/array-1d-row-major.png | Bin 0 -> 4082 bytes .../images/array-multi-col-major.png | Bin 0 -> 6200 bytes .../images/array-multi-row-major.png | Bin 0 -> 5321 bytes notes/set/index.md | 68 +++++++++ notes/x86-64/instructions.md | 129 +++++++++++++++++- 18 files changed, 519 insertions(+), 13 deletions(-) create mode 100644 notes/_journal/2024-05-12.md rename notes/_journal/{ => 2024-05}/2024-05-09.md (76%) create mode 100644 notes/_journal/2024-05/2024-05-10.md create mode 100644 notes/_journal/2024-05/2024-05-11.md create mode 100644 notes/abstract-data-types/queues.md create mode 100644 notes/abstract-data-types/stacks.md create mode 100644 notes/data-structures/arrays.md create mode 100644 notes/data-structures/images/array-1d-col-major.png create mode 100644 notes/data-structures/images/array-1d-row-major.png create mode 100644 notes/data-structures/images/array-multi-col-major.png create mode 100644 notes/data-structures/images/array-multi-row-major.png diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index a42d7f8..0036413 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -119,7 +119,11 @@ "max-heap-array.png", "max-heapify-1.png", "max-heapify-2.png", - "heapsort.gif" + "heapsort.gif", + "array-1d-row-major.png", + "array-1d-col-major.png", + "array-multi-row-major.png", + "array-multi-col-major.png" ], "File Hashes": { "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", @@ -150,7 +154,7 @@ "posix/regexp.md": "cb53e537fc10ce83307f35497d48179f", "journal/2024-02-04.md": "e2b5678fc53d7284b71ed6820c02b954", "gawk/regexp.md": "d9229f1eabe1b99e965eecaa03bee86c", - "_templates/daily.md": "5863e4524f8d012e153918d238c611a4", + "_templates/daily.md": "bfcd221502a23a285af100317b6ef127", "_journal/2024-02-05.md": "f8505abd415c50fd97c81fd6153a6d4f", "_journal/2024-02-06.md": "1ea415f3c3f5be17f796b9a0d4df565f", "_journal/2024-02-04.md": "f77a3c5f3ce7969120f226738836dc92", @@ -220,7 +224,7 @@ "_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a", "_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629", "combinatorics/permutations.md": "1b994b48798699655ee64df29c640251", - "combinatorics/combinations.md": "1109af89c5f3343ef978e4385c4b3819", + "combinatorics/combinations.md": "ce13308125a137c1fb1ed3918dbe5ccc", "_journal/2024-02-20.md": "b85ba0eeeb16e30a602ccefabcc9763e", "_journal/2024-02/2024-02-19.md": "df1a9ab7ab89244021b3003c84640c78", "combinatorics/inclusion-exclusion.md": "c27b49ee03cc5ee854d0e8bd12a1d505", @@ -268,7 +272,7 @@ "_journal/2024-03-05.md": "e9a911c19bb4c0ff451db793248cb4bb", "_journal/2024-03/2024-03-04.md": "4948d90a08af2cff58c629c9a2e11ee4", "algebra/sequences/geometric.md": "57544cab59f0b8c28d4a11f0273a3119", - "algebra/sequences/arithmetic.md": "861b6368487463a4fd6a608147df2f4f", + "algebra/sequences/arithmetic.md": "63cb1bd3a0d01942f4f7a4212c742cfd", "_journal/2024-03-06.md": "ac7a3d764934f49b2be7aa76e402d853", "_journal/2024-03/2024-03-05.md": "94b28d0b9bc62cc0bd99d315fb7c6d30", "_journal/2024-03-07.md": "7bf68d6d81e89aa00f5ddd7510b69e3e", @@ -299,7 +303,7 @@ "_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", - "set/index.md": "b82a215fbee3c576186fc1af93c82fcb", + "set/index.md": "f2e907b2643cd4e5023169dcd96ca828", "set/graphs.md": "242195a7af5dc5dfefdc07ccba8b0fa4", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391", @@ -318,7 +322,7 @@ "_journal/2024-03-22.md": "8da8cda07d3de74f7130981a05dce254", "_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3", "x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2", - "x86-64/instructions.md": "b34217258f8dd5a738fb3296d0ac744c", + "x86-64/instructions.md": "eef92b487920c7a15f38955c97a48a2d", "git/refs.md": "954fc69004aa65b358ec5ce07c1435ce", "set/trees.md": "0d21b947917498f107da140cc9fb93a7", "_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6", @@ -399,14 +403,25 @@ "data-structures/heaps.md": "0cba4acb7667dcab80fa4e7778e86cc8", "data-structures/index.md": "2605977fad54956b5dc2d8dda9be2b10", "abstract-data-types/priority-queues.md": "d3dad736cb05c47bdc93c52a3a4af083", - "abstract-data-types/index.md": "2c287ebe88f9cce0ea9fba1311b6a3a6", + "abstract-data-types/index.md": "6b110b20393c561497629ca4c3e09472", "_journal/2024-05-04.md": "679934dc63ded49503d573b8d2046e5d", "_journal/2024-05/2024-05-03.md": "be21fe4d9c1c24f74a74d06d07f8e90b", "_journal/2024-05/2024-05-02.md": "d7d6ba7e065d807986f0bd77281c0bb1", "_journal/2024-05/2024-05-01.md": "959ff67fe3db585ba6a7b121d853bbac", "_journal/2024-04/2024-04-30.md": "369f98b9d91de89cc1f4f581bc530c0d", "_journal/2024-05-06.md": "bc9306348b7063b87741768391d9d8a7", - "_journal/2024-05/2024-05-04.md": "866af1876896a343e7a7d9d09d0c24bb" + "_journal/2024-05/2024-05-04.md": "866af1876896a343e7a7d9d09d0c24bb", + "_journal/2024-05-09.md": "c2c84166b15df42c8243fc1be0550aac", + "_journal/2024-05/2024-05-08.md": "0f1b1b9e2abcf3203b511b9e034e86f4", + "_journal/2024-05/2024-05-07.md": "4b1dde039a251f9a6dc7e606de98616d", + "_journal/2024-05/2024-05-06.md": "bc9306348b7063b87741768391d9d8a7", + "_journal/2024-05-10.md": "b594772387b409cd38245d8b319260ae", + "data-structures/arrays.md": "1c648464841ee2cc86382ca176890950", + "_journal/2024-05-11.md": "3448f51b254fecca15b310d03881d734", + "_journal/2024-05/2024-05-10.md": "036bda39b619b2719dc763516d8de096", + "_journal/2024-05/2024-05-09.md": "c2c84166b15df42c8243fc1be0550aac", + "abstract-data-types/queues.md": "db668234b6c6051635321730b7176dcb", + "abstract-data-types/stacks.md": "d4324db19a88211dc6bf4f0e56c74cec" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-05-12.md b/notes/_journal/2024-05-12.md new file mode 100644 index 0000000..734f36c --- /dev/null +++ b/notes/_journal/2024-05-12.md @@ -0,0 +1,9 @@ +--- +title: "2024-05-12" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2024-05-09.md b/notes/_journal/2024-05/2024-05-09.md similarity index 76% rename from notes/_journal/2024-05-09.md rename to notes/_journal/2024-05/2024-05-09.md index 0847484..e466803 100644 --- a/notes/_journal/2024-05-09.md +++ b/notes/_journal/2024-05/2024-05-09.md @@ -12,4 +12,5 @@ title: "2024-05-09" * Accepted job with Pranav so can drop the work and interview prep TODOs. * Databases * Watched [Lecture #08](https://www.youtube.com/watch?v=9QPr8Ufzt5M8&list=PLSE8ODhjZXjaKScG3l0nuOiDTTqpfnWFf&index=8) on tree indices. - * Read chapter 14.1-14.4 of "Database Concepts". \ No newline at end of file + * Read chapter 14.1-14.4 of "Database Concepts". +* Finished a number of issues opened by Gus and Addie for Hide and Seek. \ No newline at end of file diff --git a/notes/_journal/2024-05/2024-05-10.md b/notes/_journal/2024-05/2024-05-10.md new file mode 100644 index 0000000..1389e98 --- /dev/null +++ b/notes/_journal/2024-05/2024-05-10.md @@ -0,0 +1,13 @@ +--- +title: "2024-05-10" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) + +* Made half-baked answers to [Homework #2](https://15445.courses.cs.cmu.edu/fall2022/files/hw2-clean.pdf) for the CMU DB course. +* Added `pushq` and `popq` flashcards. +* Progressed on an issue opened by Gus and Addie for Hide and Seek. \ No newline at end of file diff --git a/notes/_journal/2024-05/2024-05-11.md b/notes/_journal/2024-05/2024-05-11.md new file mode 100644 index 0000000..d657ae6 --- /dev/null +++ b/notes/_journal/2024-05/2024-05-11.md @@ -0,0 +1,12 @@ +--- +title: "2024-05-11" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) + +* Basic notes on stacks/queues/arrays. +* Continuing fixing up open issues for Hide and Seek in anticipation of next playthrough. \ No newline at end of file diff --git a/notes/abstract-data-types/index.md b/notes/abstract-data-types/index.md index abd4172..eafdadf 100644 --- a/notes/abstract-data-types/index.md +++ b/notes/abstract-data-types/index.md @@ -41,6 +41,27 @@ Reference: “Abstract Data Type.” In _Wikipedia_, March 18, 2024. [https://en END%% +%%ANKI +Cloze +{1:FIFO} is to {2:queues} as {2:LIFO} is to {1:stacks}. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Cloze +{`PUSH`} is to stacks as {`ENQUEUE`} is to queues. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Cloze +{`POP`} is to stacks as {`DEQUEUE`} is to queues. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + ## Bibliography * “Abstract Data Type.” In _Wikipedia_, March 18, 2024. [https://en.wikipedia.org/w/index.php?title=Abstract_data_type&oldid=1214359576](https://en.wikipedia.org/w/index.php?title=Abstract_data_type&oldid=1214359576). \ No newline at end of file diff --git a/notes/abstract-data-types/queues.md b/notes/abstract-data-types/queues.md new file mode 100644 index 0000000..6f72bab --- /dev/null +++ b/notes/abstract-data-types/queues.md @@ -0,0 +1,85 @@ +--- +title: Queues +TARGET DECK: Obsidian::STEM +FILE TAGS: adt::queue +tags: + - adt +--- + +## Overview + +%%ANKI +Basic +Which abstract data type is most strongly associated with FIFO? +Back: The queue. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does FIFO stand for? +Back: **F**irst **i**n, **f**irst **o**ut. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a queue's insertion method typically called? +Back: `ENQUEUE` +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a queue's deletion method typically called? +Back: `DEQUEUE` +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which element of a queue is deleted on `DEQUEUE`? +Back: The firstmost element. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean for a queue to overflow? +Back: An `ENQUEUE` was requested but the underlying data structure is full. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What queue method can invoke an overflow? +Back: `ENQUEUE` +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean for a queue to underflow? +Back: A `DEQUEUE` was requested but no elements exist in the queue. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What queue method can invoke an underflow? +Back: `DEQUEUE` +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). \ No newline at end of file diff --git a/notes/abstract-data-types/stacks.md b/notes/abstract-data-types/stacks.md new file mode 100644 index 0000000..5409372 --- /dev/null +++ b/notes/abstract-data-types/stacks.md @@ -0,0 +1,85 @@ +--- +title: Stacks +TARGET DECK: Obsidian::STEM +FILE TAGS: adt::stack +tags: + - adt +--- + +## Overview + +%%ANKI +Basic +Which abstract data type is most strongly associated with LIFO? +Back: The stack. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does LIFO stand for? +Back: **L**ast **i**n, **f**irst **o**ut. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a stack's insertion method typically called? +Back: `PUSH` +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a stack's deletion method typically called? +Back: `POP` +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which element of a stack is deleted on `POP`? +Back: The top element. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean for a stack to overflow? +Back: A `PUSH` was requested but the underlying data structure is full. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What stack method can invoke an overflow? +Back: `PUSH` +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean for a stack to underflow? +Back: A `POP` was requested but no elements exist in the stack. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What stack method can invoke an underflow? +Back: `POP` +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). \ No newline at end of file diff --git a/notes/algebra/sequences/arithmetic.md b/notes/algebra/sequences/arithmetic.md index e8ab13d..1178ef4 100644 --- a/notes/algebra/sequences/arithmetic.md +++ b/notes/algebra/sequences/arithmetic.md @@ -115,7 +115,7 @@ END%% %%ANKI Basic -Interpreted as an arithmetic sequence, what is the common ratio of the triangular numbers? +Interpreted as an arithmetic sequence, what is the common difference of the triangular numbers? Back: $1$ 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). diff --git a/notes/combinatorics/combinations.md b/notes/combinatorics/combinations.md index 6054eaf..18faca3 100644 --- a/notes/combinatorics/combinations.md +++ b/notes/combinatorics/combinations.md @@ -72,7 +72,7 @@ END%% %%ANKI Basic How is $\binom{n}{k}$ combinations of $n$ objects derived? -Back: As $(n)_k$ $k$-permutations of $n$ divided by $k!$, the numer of possible $k$-orderings. +Back: As $(n)_k$ $k$-permutations of $n$ divided by $k!$, the number of possible $k$-orderings. 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). END%% diff --git a/notes/data-structures/arrays.md b/notes/data-structures/arrays.md new file mode 100644 index 0000000..f7ad7c2 --- /dev/null +++ b/notes/data-structures/arrays.md @@ -0,0 +1,70 @@ +--- +title: Arrays +TARGET DECK: Obsidian::STEM +FILE TAGS: data_structure::array +tags: + - array + - data_structure +--- + +## Overview + +%%ANKI +Basic +What does it mean to store a matrix in row-major order? +Back: Entries in the same matrix rows are adjacent to each other in memory. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What does it mean to store a matrix in column-major order? +Back: Entries in the same matrix columns are adjacent to each other in memory. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How is the following matrix stored as a one-dimensional array in row-major order? +$$M = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}$$ +Back: +![[array-1d-row-major.png]] +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How is the following matrix stored as a one-dimensional array in column-major order? +$$M = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}$$ +Back: +![[array-1d-col-major.png]] +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How is the following matrix stored as an array of arrays in row-major order? +$$M = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}$$ +Back: +![[array-multi-row-major.png]] +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How is the following matrix stored as an array of arrays in column-major order? +$$M = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}$$ +Back: +![[array-multi-col-major.png]] +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). \ No newline at end of file diff --git a/notes/data-structures/heaps.md b/notes/data-structures/heaps.md index 1fa1e36..93c39df 100644 --- a/notes/data-structures/heaps.md +++ b/notes/data-structures/heaps.md @@ -91,7 +91,7 @@ END%% %%ANKI Basic What two sizes are associated with binary heaps? -Back: The number of valid elements and the size of the underlying array. +Back: The size of the heap and the capacity of the underlying array. Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). END%% diff --git a/notes/data-structures/images/array-1d-col-major.png b/notes/data-structures/images/array-1d-col-major.png new file mode 100644 index 0000000000000000000000000000000000000000..122d191369fab15f94fc240ed4d7d01f8a9ffeb8 GIT binary patch literal 4021 zcmc&%XH*l)whp3z6ww2MN>`*8DS=RgBT|I`3R0vBAxH~IXrYCobVUrEPz0n35`rLI z2)zUWIg~(i#0aXVPU+(2mk|9U+p0zl68m@1V{fOIJ}#axep43@CxFRIAAT7be(*~Kzw859d43srWuUCG zj4VG`(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S-VsDcXh}pZ{WA`Xk?ghC2SL7bDjcM&&Bp%nrbD9Q2d+S{Sqkc zl}yhUTlM@D6wT`Ea2#jSpPq*P|7B5n_0+H9QurXqz4Uk{fMv6hZ|I)%Pz%S8<`cTe z9NO+316GPvY0ubTWY?g|U#9n_shWc6%ML?jC9mH}HY>xm1py;Fs^}m;`zLwf#W&+b z!TUSs$)f+L7QSp!H7R*6o*-%EpGB2O)=kUpbGYc^rD+7Vz=90X=CHIhS2|pfp;`kM z(LSeQCm8=(TdMVCB#G^^84F|uMhT`}i}S4WR=9^N>-GVVNk00T9olQW|4U~4pW5R; b?p#zSzA>8fhH+r1k{Y0=WvE%HVIT1?Wh~++ literal 0 HcmV?d00001 diff --git a/notes/data-structures/images/array-1d-row-major.png b/notes/data-structures/images/array-1d-row-major.png new file mode 100644 index 0000000000000000000000000000000000000000..2540ed71eb899b96be895dfa581c78fb9aefd263 GIT binary patch literal 4082 zcmcgvcQ_l|_s?5fUsY99%~DmPh*hMGx0;$o5j9FRX6?Oat5zvhiXdi{SM3!EF>1u7 zC_;=Pl*Aq}f?xXo?|Hu8zrOd6d++(2bDr~@d+)jTe&U|#X|OQgWCj2LELxfnLjd3} zD0ObnNKfrkO&p7<1Fg537L<|NLKtmhsWP|E6H^}}cY7ayn3o;E!Oh*(?w+@emz|xP z_iJ~bEt*y^)kyr0(PJ+=n2)2on;_KD)ec|;^AQ9B1$AM8g0eEQ@`6Bl6?tV9d09bS z2o!YfMHv9Vs;32c1P#dEnDw_XIatK*aPdG4{-V=*;>kMBYtcb`I%pBNrEdYZc3hEk z#SaiGUZla(X1x}k4vtzxX?MU0X;s%*ES4|HF$n5}g=f5OUAR1z?A>xcH{9Cdk(ji1 zxD#>TAq1Se1h5qr5(PoO1I98NLplZjXW-Bi-#lb- z%cG*UwgQ#xd?Pgxx0{>`ZB}+QPZmJ-FxS8IcqnUlP1)y_ zh5_HGjBzCW#|?lda6W_TACxB^J`SJXjx@|I%d zFJe#S05x-0l>-9ABE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nLcIMd8kd|?TXmme4OYPm#06I)-S|37|7HC~n z{6xww`XS}<3x%wz@}PAqdt{V(s}{@6^Ku$vCxyJAa&_f-0Y!Vo51ADrV!$^C5<-%- z(2OjJry0jjhMe`77l{WG-0JnP!3UZ0TiVC(e{QofT8}rP5-4OADa)g%socYBsNG0a z$p`nkr#S05q_?;n&ol-4j7y?T;tb!h1i)*VJbCeF3N|rF(Y5A!D@jI={cUdbeK+;= zIej)T$(JHf(s?j`J&|t?J6?^M!pxpHk8-}7<#gK5F)bi>X7UxbjgG=zC;8c98=Y6L zRmjyj1XKE(jA~M)*VY^@Fd@lS()cP8+~84pM(aq;Ry#VGg_u@pJG)Cs5355v_g00x zr0rjQlEFvFsh&~e@Xpq0974ULt+k0Y{Zya35F0zi#!(s@`v_VhBt&nJ|33BxBuZS! z`s#lVGURD;TAj+ueliq^Pxje_8t@K1d!)cmD+r!ApK#ef_!bfVk4R!?h`znO`uRnh zT5~9csl@a{2XH>wF2)^L#*I()cF^0N>GJ-=P1b!MYihNqecuuOBSpObIVEt$PD2ki zUdBq*5KcLzE!E+&cJJ3cqDy@ig}QWtJb#be`a@B)Dg&G*TiX2Rw-iCz`5e-lS{}1H zqWcA{5yr!45T710_m5&3op6Ed;)Ly;)KiG8Rv;Y7A literal 0 HcmV?d00001 diff --git a/notes/data-structures/images/array-multi-col-major.png b/notes/data-structures/images/array-multi-col-major.png new file mode 100644 index 0000000000000000000000000000000000000000..7bcdc42f90d72adecdb301af4e28eedc559e493a GIT binary patch literal 6200 zcmbuD2T&B>y6r)7QprgKL_sn`9)_Re{<&*WSH*{nq-Tv^Aj=q)enZI5-q4%8I(ceG@qA zi3x#gHusAg;D+xlucA*39Kpo4?}2AVA0=ZSJ$HK_KPxXg90xadS37=h8!tOMH}9A3 zK3KeVS)dco-%bi%c2+))?rv=Qj;?k%dR9JcAP}2|RREi?kgzBlNK{HpR0<@@rlF|+ zaz&OO2ZugcMe(V=f7Z@Iz!UwA>%Kh+$m95RuL*n_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XcO*_xTw=xMsPSC89%P;4K z-hL0IDvkW{F=6iYcyUvc&h-)>?l)F_gZZ0m0Sb1W#iU^2jF+2xqc*0aH2c05F-1<0 zH@{L_b>u?6qdi(0D!B#o&iN)A?Koz@j3;h3xYS46sWLgixc|bd^Q&bSlEF)RwT%ud zrvZL_g6r5H>NykuQ6!0|4c5=BwBTPo&jp_#b@R_wVECM z(Ct6ir%`p=)2`1?Y6`e<8FY1Zy&~(sO*tUPrNWy-Ipg8v^`+5EUSKf~4~8ScOvrir z(}MNJWs`JDN?$6oA)+RmN1wbg_4=%UTKDisw?lxbYKC^{Dc&*)b1yj&eKbk=Gqu%i zb=`brt{e#~OiFx%j`NSt6BUV3?Zx8 z!#%t`3H_~iD$FNMC4HUDTB#46BEcB$vuh8EU_ee}X1H`k>oX&nnUQvUJRDS+xBLH~ zI&jg#QJn-cMb6vrcdelN2|0yD*}VG2Jis!^jI!^#EVuEE2%{jMQ_XxXMg?D~3!;GJ zSV{E_`mss_=)~lR=kfAcGM13=(sO|fp=>G$q~sq497Rd^)t>e)B<2y*&=} zFa85Q6EcHWB9$vkSZBb?;|O@PRS0KUmUv|GRrpv5&`TjpY;4Pyc>gwt&joQ+Iz;Tc{@z1YALrrV!`P+AI7{!C-GuKuN>}kc^ zP!RfZbPoz%%*ZSo8CZCm)o|eaytm+@+*1ByPvF|K4E%u>qNoj3cP_caTbl>&o()gM zdF{ve1d+)3QxBxd8H(|tY@X=nVGj=%jq{`PeWB=zatMiwg17!BK{eJ5VZq;+o} z@$S!yN0vF^22uUZ$(cQIrQvCcc6=mf53zvvdkHvWKAcCL1U2}!p+wn!ZBUqe<0Jk{ zUv7x2C7l8Xg+0Y(vn8yU_yOkswfb~eVZb`w@K)~7jcI?nmCobnnDh7d1E{h<1*!YN zF=7J8 +END%% + +%%ANKI +Basic +How does Knuth distinguish mathematical sets from dynamic sets? +Back: The former is assumed to be unchanging. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: adt::dynamic_set + +END%% + +%%ANKI +Basic +How does Knuth define a dictionary? +Back: As a dynamic set that allows insertions, deletions, and membership tests. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: adt::dynamic_set + +END%% + +%%ANKI +Basic +Which of dynamic sets and dictionaries are more general? +Back: The dynamic set. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: adt::dynamic_set + +END%% + +%%ANKI +Basic +Is a dynamic set a dictionary? +Back: Not necessarily. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: adt::dynamic_set + +END%% + +%%ANKI +Basic +Is a dictionary a dynamic set? +Back: Yes. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: adt::dynamic_set + +END%% + +%%ANKI +Cloze +A dictionary supports {insertions}, {deletions}, and {membership testing}. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: adt::dynamic_set + +END%% + +## Bibliography + +* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). \ No newline at end of file diff --git a/notes/x86-64/instructions.md b/notes/x86-64/instructions.md index 1337832..6d1c02b 100644 --- a/notes/x86-64/instructions.md +++ b/notes/x86-64/instructions.md @@ -367,6 +367,30 @@ END%% ### `MOV` +The MOV instruction class has four primary variants: `movb`, `movw`, `movl`, and `movq`. There also exist zero extension and sign extension variations in the forms of MOVS and MOVZ. + +| Instruction | Operands | Effect | Description | +| ----------- | -------- | ---------------- | ------------------------------------------- | +| `movb` | S, D | D <- S | Move byte | +| `movw` | S, D | D <- S | Move word | +| `movl` | S, D | D <- S | Move double word | +| `movq` | S, D | D <- S | Move quad word | +| `movabsq` | I, R | R <- I | Move quad word | +| `movzbw` | S, R | R <- ZE(S) | Move zero-extended byte to word | +| `movzbl` | S, R | R <- ZE(S) | Move zero-extended byte to double word | +| `movzwl` | S, R | R <- ZE(S) | Move zero-extended word to double word | +| `movzbq` | S, R | R <- ZE(S) | Move zero-extended byte to quad word | +| `movzwq` | S, R | R <- ZE(S) | Move zero-extended word to quad word | +| `movsbw` | S, R | R <- SE(S) | Move sign-extended byte to word | +| `movsbl` | S, R | R <- SE(S) | Move sign-extended byte to double word | +| `movswl` | S, R | R <- SE(S) | Move sign-extended word to double word | +| `movsbq` | S, R | R <- SE(S) | Move sign-extended byte to quad word | +| `movswq` | S, R | R <- SE(S) | Move sign-extended word to quad word | +| `movslq` | S, R | R <- SE(S) | Move sign-extended double word to quad word | +| `cltq` | | %rax <- SE(%eax) | Sign-extend `%eax` to `%rax` | + +Notice there is no `movzlq` instruction. `movl` covers this functionality since, by convention, instructions moving double words into a 64-bit register automatically zeroes out the upper 32 bits. + %%ANKI Basic What four variants does `MOV` instructions take on in x86-64? @@ -586,7 +610,7 @@ END%% %%ANKI Basic Why does there not exist a `movzlq` instruction? -Back: Because `movl` already zeros out the upper bits of a destination register. +Back: Because `movl` already zeroes out the upper bits of a destination register. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -647,6 +671,109 @@ Tags: c17 END%% +### PUSH and POP + +| Instruction | Operands | Effect | Description | +| ----------- | -------- | ------------------------------------------- | -------------- | +| `pushq` | S | R[%rsp] <- R[%rsp] - 8
M[R[%rsp]] <- S | Push quad word | +| `popq` | D | D <- M[R[%rsp]]
R[%rsp] <- R[%rsp] + 8 | Pop quad word | + +In x86 processors, the stack grows downward, with the "top" of the stack corresponding to lower addresses. + +%%ANKI +Basic +In what direction do x86-64 stacks grow? +Back: Downward. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +The x86-64 stack grows such that the top element has the {lowest} address of all stack elements. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What instruction is used to push elements onto the stack? +Back: `pushq` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What instruction is used to pop elements off of the stack? +Back: `popq` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How is `pushq %rbp` equivalently written using a pair of instructions? +Back: +```asm +subq 8,%rsp +movq %rbp,(%rsp) +``` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How is `popq %rax` equivalently written using a pair of instructions? +Back: +```asm +movq (%rsp),%rax +addq 8,%rsp +``` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:`pushq`} is to {2:`subq`} as {2:`popq`} is to {1:`addq`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +If `%rsp` has value `0x108`, what value does it have after a `pushq` instruction? +Back: `0x100` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +If `%rsp` has value `0x108`, what value does it have after a `popq` instruction? +Back: `0x110` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which register contains a pointer to the top of the stack? +Back: `%rsp` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the `%rsp` register typically used for? +Back: The stack pointer. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + ## Bibliography * Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.