diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index 8dc322c..0238427 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -124,7 +124,7 @@ "algorithms/sorting/selection-sort.md": "fcd0dc2ebaabd0a4db1baf7e7ef9f7a9", "algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97", "binary/hexadecimal.md": "c3d485f1fd869fe600334ecbef7d5d70", - "binary/index.md": "27bdd4423e323cd961ddb307ab28d977", + "binary/index.md": "b4db8fe8ae874a682a5acf81271e303b", "_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109", "c/types.md": "cf3e66e5aee58a94db3fdf0783908555", "logic/quantification.md": "5d7579a511e9ff683edeec62bcc291b8", @@ -171,10 +171,12 @@ "combinatorics/index.md": "f9de9671fdb6068ef2bb5e63051734be", "_journal/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629", "_journal/2024-02/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048", - "combinatorics/multiplicative-principle.md": "aec83fc4bafad4ae17bd3b4e92e068a1", - "combinatorics/additive-principle.md": "99320b513f16ef6be62bf766cfbd328d", - "_journal/2024-02-19.md": "77ade15d43f3fba69bde96d0e062ec13", - "_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629" + "combinatorics/multiplicative-principle.md": "3e4f600f5300d3d4d64099b8f2bd1458", + "combinatorics/additive-principle.md": "84dcd0243263b3c53456086ae43fa00f", + "_journal/2024-02-19.md": "87d762a68e9b8e3c7de0f02d651b1101", + "_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629", + "combinatorics/permutations.md": "3c76f548e22f7271280b9ed82ae584ec", + "combinatorics/combinations.md": "0fb5351d4b0ab6c7c8cd17d9423d3dfa" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-02-19.md b/notes/_journal/2024-02-19.md index 00d3eae..4bd167c 100644 --- a/notes/_journal/2024-02-19.md +++ b/notes/_journal/2024-02-19.md @@ -8,4 +8,6 @@ title: "2024-02-19" - [ ] OGS (1 Life & Death Problem) - [ ] Korean (Read 1 Story) - [ ] Interview Prep (1 Practice Problem) -- [ ] Log Work Hours (Max 3 hours) \ No newline at end of file +- [ ] Log Work Hours (Max 3 hours) + +* Start encoding notes on permutations and combinations, as well as their relationship to one another. \ No newline at end of file diff --git a/notes/binary/index.md b/notes/binary/index.md index 30f94fd..20ebce5 100644 --- a/notes/binary/index.md +++ b/notes/binary/index.md @@ -6,6 +6,46 @@ tags: - binary --- +## Overview + +A binary digit or **bit** is a `0` or `1` character. A bit string is then a contiguous sequence of bits. It's **weight** is a reference to the number of `1`s in the bit string. Compare the below operation to the method for converting from one numerical base to another (e.g. [[hexadecimal]]). + +```c +unsigned int bit_weight(int64_t n) { + unsigned int count = 0; + while (n) { + count += (n % 2 == 0) ? 0 : 1; + n /= 2; + } + return count; +} +``` + +%%ANKI +Basic +Why is a "bit" named the way it is? +Back: It is short for **b**inary dig**it**. +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%% + +%%ANKI +Basic +What does the weight of a bit string refer to? +Back: The number of `1`s in the string. +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%% + +%%ANKI +Basic +How might you use C to find the weight of a bit string? +Back: Repeatedly divide by `2`, counting all remainders of `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). +Tags: c + +END%% + %%ANKI Cloze A byte consists of {8} bits. diff --git a/notes/combinatorics/additive-principle.md b/notes/combinatorics/additive-principle.md index ae46769..b5ace68 100644 --- a/notes/combinatorics/additive-principle.md +++ b/notes/combinatorics/additive-principle.md @@ -4,12 +4,15 @@ TARGET DECK: Obsidian::STEM FILE TAGS: combinatorics set tags: - combinatorics + - set --- ## Overview The **additive principle** states that two finite and disjoint sets $A$ and $B$ satisfy $$|A \cup B| = |A| + |B|$$ +This can be generalized to any number of finite and disjoint sets in the obvious way. + %%ANKI Basic What does the additive principle state? diff --git a/notes/combinatorics/combinations.md b/notes/combinatorics/combinations.md new file mode 100644 index 0000000..7ba68cf --- /dev/null +++ b/notes/combinatorics/combinations.md @@ -0,0 +1,189 @@ +--- +title: Combinations +TARGET DECK: Obsidian::STEM +FILE TAGS: combinatorics set +tags: + - combinatorics + - set +--- + +## Overview + +A $k$-**combination** of $n$ objects is an unordered "choice" of $k$ objects from the collection of $n$ objects. Alternatively viewed, it is a set of $k$ objects - ordering within a set does not matter. Combinations are derived by considering the number of $k$-[[permutations]] of $n$ objects and discarding order, i.e. dividing by $k!$. $$\binom{n}{k} = \frac{(n)_k}{k!} = \frac{n!}{k!(n - k)!}$$ + +```c +void combinations_aux( + const int i, const int n, + const int j, const int k, + int A[static n], + int res[static k] +) { + if (j == k) { + for (int m = 0; m < k; ++m) { + printf("%d ", A[res[m]]); + } + printf("\n"); + return + } else if (n - i < k - j) { + return; + } + res[j] = A[i]; + combinations_aux(i + 1, n, j + 1, k, A, res); + combinations_aux(i + 1, n, j, k, A, res); +} + +void combinations(const int n, const int k, int A[static n]) { + int *res = malloc(sizeof(int) * k); + combinations_aux(0, n, 0, k, A, res); + free(res); +} +``` + +The above approach prints out all $k$-combinations of a given array. + +%%ANKI +Basic +What *is* a combination? +Back: An unordered collection of objects. +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%% + +%%ANKI +Cloze +{1:Permutations} are to {2:tuples} as {2:combinations} are to {1:sets}. +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%% + +%%ANKI +Basic +How is a $k$-combination expressed recursively? +Back: Include or exclude a candidate, then find $(k - 1)$- or $k$-combinations on the remainder. +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%% + +%%ANKI +Basic +How is a $k$-combination of $n$ objects denoted? +Back: $\binom{n}{k}$ +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%% + +%%ANKI +Basic +How is $\binom{n}{k}$ pronounced? +Back: "$n$ choose $k$" +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%% + +%%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. +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%% + +%%ANKI +Basic +How is the closed formula of $\binom{n}{k}$ written in terms of factorials (*not* falling factorials)? +Back: $$\binom{n}{k} = \frac{n!}{k!(n - k)!}$$ +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%% + +%%ANKI +Basic +How do $k$-permutations of $n$ objects relate to $k$-combinations? +Back: The number of $k$-combinations is the number of $k$-permutations divided by $k!$. +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%% + +%%ANKI +Basic +How is the closed formula of $\binom{n}{k}$ written in terms of falling factorials? +Back: $$\binom{n}{k} = \frac{(n)_k}{k!}$$ +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%% + +%%ANKI +Basic +What combinatorial concept explains the number of subsets of a finite set? +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). + +END%% + +%%ANKI +Basic +How many subsets of $\{a, b, c, d, e\}$ have exactly $3$ members? +Back: $\binom{5}{3}$ +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%% + +%%ANKI +Basic +*Why* are binomial coefficients "symmetric" +Back: The number of ways to choose $k$ objects is the same as the number of ways to *not* choose those $k$ objects. +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%% + +%%ANKI +Basic +What value of $k \neq 1$ makes $\binom{n}{1} = \binom{n}{k}$? +Back: $n - 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). + +END%% + +%%ANKI +Basic +What does $\binom{n}{0}$ evaluate to? +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). + +END%% + +%%ANKI +Basic +What does $\binom{n}{n}$ evaluate to? +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). + +END%% + +%%ANKI +Basic +What term describes e.g. $\binom{n}{1}$, $\binom{n}{2}$, etc.? +Back: The binomial coefficients. +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%% + +%%ANKI +Basic +What is a binomial? +Back: A polynomial containing two terms. +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%% + +%%ANKI +Basic +What are binomial coefficients? +The coefficients of terms in the expansion of a binomial, e.g. $(x + y)^n$. +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%% + +## References + +* 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). \ No newline at end of file diff --git a/notes/combinatorics/multiplicative-principle.md b/notes/combinatorics/multiplicative-principle.md index aea86b9..6894837 100644 --- a/notes/combinatorics/multiplicative-principle.md +++ b/notes/combinatorics/multiplicative-principle.md @@ -11,6 +11,8 @@ tags: The **multiplicative principle** states that two finite sets $A$ and $B$ satisfy $$|A \times B| = |A| \cdot |B|$$ +This can be generalized to any number of finite sets in the obvious way. + %%ANKI Basic What does the multiplicative principle state? diff --git a/notes/combinatorics/permutations.md b/notes/combinatorics/permutations.md new file mode 100644 index 0000000..c9cf27d --- /dev/null +++ b/notes/combinatorics/permutations.md @@ -0,0 +1,247 @@ +--- +title: Permutations +TARGET DECK: Obsidian::STEM +FILE TAGS: combinatorics set +tags: + - combinatorics + - set +--- + +## Overview + +A **permutation** of some $n$ objects is a (possible) rearrangement of those $n$ objects. The number of permutations is $n!$ since there are $n$ possible ways to pick the first object, $(n - 1)$ possible ways to pick the second, and so on. + +```c +void permutations_aux( + const size_t n, + int A[static n], + int res[static n], + uint64_t choices +) { + if (!choices) { + for (size_t i = 0; i < n; ++i) { + printf("%d ", A[res[i]]); + } + printf("\n"); + return; + } + + unsigned int weight = n - bit_weight(choices); + for (unsigned int i = 0; i < 64; ++i) { + uint64_t next = 1L << i; + if (choices & next) { + res[weight] = i; + permutations_aux(n, A, res, choices & ~next); + } + } +} + +void permutations(const size_t n, int A[static n]) { + int *res = malloc(sizeof(int) * n); + permutations_aux(n, A, res, (1L << n) - 1); + free(res); +} +``` + +The above approach prints out all permutations of a given array, provided the array contains at most `64` digits. It relies on `bit_weight` as defined in [[binary/index|binary]]. + +%%ANKI +Basic +What *is* a permutation? +Back: An ordered arrangement of some collection of objects. +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%% + +%%ANKI +Basic +How many permutations are there of $n$ objects? +Back: $n!$ +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%% + +%%ANKI +Basic +How is permutation expressed recursively? +Back: Put each candidate in the current position, finding all permutations of the remainder each time. +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%% + +%%ANKI +Basic +How is $n!$ permutations of $n$ objects derived? +Back: There are $n$ choices for the first position, $n - 1$ choices for the second, etc. +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%% + +%%ANKI +Basic +What combinatorial concept explains $n!$ permutations of $n$ objects? +Back: The multiplicative principle. +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%% + +%%ANKI +Basic +What combinatorial concept is often associated with the factorial? +Back: Permutations. +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%% + +%%ANKI +Basic +How does sorting relate to the concept of permutations? +Back: Sorting aims to efficiently find a specific permutation. +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). +Tags: algorithm + +END%% + +%%ANKI +Basic +What symbol denotes "$n$ factorial"? +Back: $n!$ +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%% + +%%ANKI +Basic +What is $n!$ shorthand for? +Back: $\Pi_{k=1}^n k$ +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%% + +%%ANKI +Basic +What is the identity element of $\cdot$ (multiplication)? +Back: $1$ +Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. + +END%% + +%%ANKI +Basic +What does $0!$ (factorial) evaluate to? +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). + +END%% + +%%ANKI +Basic +*Why* might $0! = 1$ (barring convention)? +Back: Because the empty product is $1$, the multiplication identity. +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%% + +%%ANKI +Basic +What combinatorial concept explains the number of bijective functions between two finite sets? +Back: Permutations (factorials). +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%% + +%%ANKI +Basic +How many bijective functions exist between $\{1, 2, 3\}$ and $\{a, b, c\}$? +Back: $3!$ +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%% + +%%ANKI +Basic +How many bijective functions exist between finite sets $A$ and $B$ where $|A| = |B| = n$? +Back: $n!$ +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%% + +If we generalize to choosing $k \leq n$ elements of $k$ objects, we can calculate the $k$-permutation of $n$. This is denoted as $(n)_k$, sometimes called the **falling factorial**. $$(n)_k = \frac{n!}{(n - k)!}$$ + +The derivation works by noting that we have $n - 0$ possible ways to pick the first object, $n - 1$ ways to pick the second, up until $n - (k - 1)$ ways to pick the last object. + +%%ANKI +Basic +What *is* a $k$-permutation? +Back: An ordered arrangement, containing $k$ elements, of some collection of objects. +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%% + +%%ANKI +Basic +What is the closed formula for $(n)_k$ (falling factorial)? +Back: $$(n)_k = \frac{n!}{(n - k)!}$$ +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%% + +%%ANKI +Basic +How many $k$-permutations are there of $n$ objects? +Back: $(n)_k$ +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%% + +%%ANKI +Basic +How is $(n)_k$ $k$-permutations of $n$ objects derived? +Back: There are $n$ choices for the first position, $n - 1$ choices for the second, etc. up until $n - (k - 1)$ choices for the last position. +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%% + +%%ANKI +Basic +What does $(n)_n$ evaluate to? +Back: $n!$ +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%% + +%%ANKI +Basic +What does $(n)_0$ evaluate to? +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). + +END%% + +%%ANKI +Cloze +In a $k$-permutation of $n$ objects, there are $n - 0$ choices for first object and {$n - (k - 1)$} choices for the last object. +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%% + +%%ANKI +Basic +What combinatorial concept explains the number of injective functions between two finite sets? +Back: $k$-permutations (falling factorials). +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%% + +%%ANKI +Basic +How many injective functions exist between $\{1, 2, 3\}$ and $\{a, b, c, d, e\}$? +Back: $(5)_3$ +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%% + +## References + +* Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. +* 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). \ No newline at end of file