Initial notes on open/closed addressing.
parent
7664346b62
commit
9045439d0b
|
@ -134,7 +134,10 @@
|
||||||
"venn-diagram-intersection.png",
|
"venn-diagram-intersection.png",
|
||||||
"venn-diagram-rel-comp.png",
|
"venn-diagram-rel-comp.png",
|
||||||
"venn-diagram-abs-comp.png",
|
"venn-diagram-abs-comp.png",
|
||||||
"venn-diagram-symm-diff.png"
|
"venn-diagram-symm-diff.png",
|
||||||
|
"relation-ordering-example.png",
|
||||||
|
"open-addressing.png",
|
||||||
|
"closed-addressing.png"
|
||||||
],
|
],
|
||||||
"File Hashes": {
|
"File Hashes": {
|
||||||
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
|
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
|
||||||
|
@ -173,7 +176,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": "d6d9c7dacac07540ddc20608c8a805e5",
|
"logic/equiv-trans.md": "8bfb004bc500f32620aff7b95c0d92d7",
|
||||||
"_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",
|
||||||
|
@ -314,7 +317,7 @@
|
||||||
"_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": "d1fcdfe4506aab4ec86f30118464fb2a",
|
"set/index.md": "24a66a792b7b75329590dcfc495faa91",
|
||||||
"set/graphs.md": "4bbcea8f5711b1ae26ed0026a4a69800",
|
"set/graphs.md": "4bbcea8f5711b1ae26ed0026a4a69800",
|
||||||
"_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",
|
||||||
|
@ -451,8 +454,8 @@
|
||||||
"_journal/2024-05-17.md": "fb880d68077b655ede36d994554f3aba",
|
"_journal/2024-05-17.md": "fb880d68077b655ede36d994554f3aba",
|
||||||
"_journal/2024-05/2024-05-16.md": "9fdfadc3f9ea6a4418fd0e7066d6b10c",
|
"_journal/2024-05/2024-05-16.md": "9fdfadc3f9ea6a4418fd0e7066d6b10c",
|
||||||
"_journal/2024-05-18.md": "c0b58b28f84b31cea91404f43b0ee40c",
|
"_journal/2024-05-18.md": "c0b58b28f84b31cea91404f43b0ee40c",
|
||||||
"hashing/direct-addressing.md": "87d1052ac7eae3061d88d011432cb693",
|
"hashing/direct-addressing.md": "acff356a70980cb4135094fccb3b3187",
|
||||||
"hashing/index.md": "8912a564ac1066de14044421fdc35b75",
|
"hashing/index.md": "2f75e951aac609a2a9da731ef5444214",
|
||||||
"set/classes.md": "6776b4dc415021e0ef60b323b5c2d436",
|
"set/classes.md": "6776b4dc415021e0ef60b323b5c2d436",
|
||||||
"_journal/2024-05-19.md": "fddd90fae08fab9bd83b0ef5d362c93a",
|
"_journal/2024-05-19.md": "fddd90fae08fab9bd83b0ef5d362c93a",
|
||||||
"_journal/2024-05/2024-05-18.md": "c0b58b28f84b31cea91404f43b0ee40c",
|
"_journal/2024-05/2024-05-18.md": "c0b58b28f84b31cea91404f43b0ee40c",
|
||||||
|
@ -475,7 +478,7 @@
|
||||||
"_journal/2024-05/2024-05-25.md": "3e8a0061fa58a6e5c48d12800d1ab869",
|
"_journal/2024-05/2024-05-25.md": "3e8a0061fa58a6e5c48d12800d1ab869",
|
||||||
"_journal/2024-05-27.md": "b36636d10eab34380f17f288868df3ae",
|
"_journal/2024-05-27.md": "b36636d10eab34380f17f288868df3ae",
|
||||||
"_journal/2024-05/2024-05-26.md": "abe84b5beae74baa25501c818e64fc95",
|
"_journal/2024-05/2024-05-26.md": "abe84b5beae74baa25501c818e64fc95",
|
||||||
"algebra/set.md": "7eb2f9cae83e9aaf16aa42f82cea944f",
|
"algebra/set.md": "9aadf7ca6153592b5af7e942021e56de",
|
||||||
"algebra/boolean.md": "ee41e624f4d3d3aca00020d9a9ae42c8",
|
"algebra/boolean.md": "ee41e624f4d3d3aca00020d9a9ae42c8",
|
||||||
"git/merge-conflicts.md": "761ad6137ec51d3877f7d5b3615ca5cb",
|
"git/merge-conflicts.md": "761ad6137ec51d3877f7d5b3615ca5cb",
|
||||||
"_journal/2024-05-28.md": "0f6aeb5ec126560acdc2d8c5c6570337",
|
"_journal/2024-05-28.md": "0f6aeb5ec126560acdc2d8c5c6570337",
|
||||||
|
@ -500,7 +503,7 @@
|
||||||
"_journal/2024-06/2024-06-04.md": "52b28035b9c91c9b14cef1154c1a0fa1",
|
"_journal/2024-06/2024-06-04.md": "52b28035b9c91c9b14cef1154c1a0fa1",
|
||||||
"_journal/2024-06-06.md": "3f9109925dea304e7172df39922cc95a",
|
"_journal/2024-06-06.md": "3f9109925dea304e7172df39922cc95a",
|
||||||
"_journal/2024-06/2024-06-05.md": "b06a0fa567bd81e3b593f7e1838f9de1",
|
"_journal/2024-06/2024-06-05.md": "b06a0fa567bd81e3b593f7e1838f9de1",
|
||||||
"set/relations.md": "42f3dff509071ad31d6831e1c05e5aa9",
|
"set/relations.md": "80ad79358f1ce6ecf488a059c4de78bb",
|
||||||
"_journal/2024-06-07.md": "795be41cc3c9c0f27361696d237604a2",
|
"_journal/2024-06-07.md": "795be41cc3c9c0f27361696d237604a2",
|
||||||
"_journal/2024-06/2024-06-06.md": "db3407dcc86fa759b061246ec9fbd381",
|
"_journal/2024-06/2024-06-06.md": "db3407dcc86fa759b061246ec9fbd381",
|
||||||
"_journal/2024-06-08.md": "b20d39dab30b4e12559a831ab8d2f9b8",
|
"_journal/2024-06-08.md": "b20d39dab30b4e12559a831ab8d2f9b8",
|
||||||
|
@ -516,8 +519,12 @@
|
||||||
"_journal/2024-06/2024-06-08.md": "9e1ebc8882a395b96ca765ad5c982d68",
|
"_journal/2024-06/2024-06-08.md": "9e1ebc8882a395b96ca765ad5c982d68",
|
||||||
"_journal/2024-06-10.md": "84d27300b97c8544ab4ec68b06edd824",
|
"_journal/2024-06-10.md": "84d27300b97c8544ab4ec68b06edd824",
|
||||||
"_journal/2024-06/2024-06-09.md": "4c336a39775846b416aa73278435065f",
|
"_journal/2024-06/2024-06-09.md": "4c336a39775846b416aa73278435065f",
|
||||||
"_journal/2024-06-11.md": "4988503ee98aa4fe32d5eeaea2cc65a5",
|
"_journal/2024-06-11.md": "48f46f654a1b8dfeebc01b3adb2bc1d1",
|
||||||
"_journal/2024-06/2024-06-10.md": "1fe3a8beb03b1cc9af188b85933339e4"
|
"_journal/2024-06/2024-06-10.md": "1fe3a8beb03b1cc9af188b85933339e4",
|
||||||
|
"_journal/2024-06-12.md": "8cc810c0f594093768117f57461e2e9e",
|
||||||
|
"_journal/2024-06/2024-06-11.md": "764ccba25646673fdf7bb6a5f090394d",
|
||||||
|
"hashing/open-addressing.md": "c27e92f2865bbb426fdd1e30fc52f1ed",
|
||||||
|
"hashing/closed-addressing.md": "962a48517969bf5e410cf78fc584051f"
|
||||||
},
|
},
|
||||||
"fields_dict": {
|
"fields_dict": {
|
||||||
"Basic": [
|
"Basic": [
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
title: "2024-06-11"
|
|
||||||
---
|
|
||||||
|
|
||||||
- [x] Anki Flashcards
|
|
||||||
- [x] KoL
|
|
||||||
- [x] OGS
|
|
||||||
- [ ] Sheet Music (10 min.)
|
|
||||||
- [ ] Korean (Read 1 Story)
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
title: "2024-06-12"
|
||||||
|
---
|
||||||
|
|
||||||
|
- [x] Anki Flashcards
|
||||||
|
- [x] KoL
|
||||||
|
- [x] OGS
|
||||||
|
- [ ] Sheet Music (10 min.)
|
||||||
|
- [ ] Korean (Read 1 Story)
|
||||||
|
|
||||||
|
* Notes on [[open-addressing|open]] and [[closed-addressing|closed]] hashing.
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
title: "2024-06-11"
|
||||||
|
---
|
||||||
|
|
||||||
|
- [x] Anki Flashcards
|
||||||
|
- [x] KoL
|
||||||
|
- [x] OGS
|
||||||
|
- [ ] Sheet Music (10 min.)
|
||||||
|
- [ ] Korean (Read 1 Story)
|
||||||
|
|
||||||
|
* Cartesian product [[set#Cancellation Laws|cancellation laws]].
|
||||||
|
* Notes on [[relations]].
|
|
@ -27,6 +27,85 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
||||||
<!--ID: 1716396060605-->
|
<!--ID: 1716396060605-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
## Symmetric Difference
|
||||||
|
|
||||||
|
Define the **symmetric difference** of sets $A$ and $B$ as $$A \mathop{\triangle} B = (A - B) \cup (B - A)$$
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What two operators are used in the definition of the symmetric difference?
|
||||||
|
Back: $\cup$ and $-$.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717554445662-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the symmetric difference of sets $A$ and $B$ denoted?
|
||||||
|
Back: $A \mathop{\triangle} B$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717554445665-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is $A \mathop{\triangle} B$ defined?
|
||||||
|
Back: As $(A - B) \cup (B - A)$.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717554445670-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Cartesian Product
|
||||||
|
|
||||||
|
Given two sets $A$ and $B$, the **Cartesian product** $A \times B$ is defined as: $$A \times B = \{\langle x, y \rangle \mid x \in A \land y \in B\}$$
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the Cartesian product of $A$ and $B$ denoted?
|
||||||
|
Back: $A \times B$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717679397781-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Using ordered pairs, how is $A \times B$ defined?
|
||||||
|
Back: $\{\langle x, y \rangle \mid x \in A \land y \in B\}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717679397797-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Who is attributed the representation of points in a plane?
|
||||||
|
Back: René Descartes.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717679397825-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Why is the Cartesian product named the way it is?
|
||||||
|
Back: It is named after René Descartes.
|
||||||
|
Reference: “Cartesian Product,” in _Wikipedia_, April 17, 2024, [https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305](https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305).
|
||||||
|
<!--ID: 1717679397836-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Suppose $x, y \in A$. What set is $\langle x, y \rangle$ in?
|
||||||
|
Back: $\mathscr{P}\mathscr{P}A$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717679397848-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
{$x \in A$} iff {$\{x\} \subseteq A$} iff {$\{x\} \in \mathscr{P}A$}.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1717679397860-->
|
||||||
|
END%%
|
||||||
|
|
||||||
## Laws
|
## Laws
|
||||||
|
|
||||||
The algebra of sets obey laws reminiscent (but not exactly) of the algebra of real numbers.
|
The algebra of sets obey laws reminiscent (but not exactly) of the algebra of real numbers.
|
||||||
|
@ -676,32 +755,43 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
||||||
<!--ID: 1717073537007-->
|
<!--ID: 1717073537007-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
## Symmetric Difference
|
### Cancellation Laws
|
||||||
|
|
||||||
Define the **symmetric difference** of sets $A$ and $B$ as $$A \mathop{\triangle} B = (A - B) \cup (B - A)$$
|
Let $A$, $B$, and $C$ be sets. If $A \neq \varnothing$,
|
||||||
|
|
||||||
|
* $(A \times B = A \times C) \Rightarrow B = C$
|
||||||
|
* $(B \times A = C \times A) \Rightarrow B = C$
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What two operators are used in the definition of the symmetric difference?
|
What is the left cancellation law of the Cartesian product?
|
||||||
Back: $\cup$ and $-$.
|
Back: $(A \times B = A \times C) \Rightarrow B = C$
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717554445662-->
|
<!--ID: 1718107987907-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
How is the symmetric difference of sets $A$ and $B$ denoted?
|
$(A \times B = A \times C) \Rightarrow B = C$ is always true if what condition is satisfied?
|
||||||
Back: $A \mathop{\triangle} B$
|
Back: $A \neq \varnothing$
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717554445665-->
|
<!--ID: 1718107987918-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
How is $A \mathop{\triangle} B$ defined?
|
What is the right cancellation law of the Cartesian product?
|
||||||
Back: As $(A - B) \cup (B - A)$.
|
Back: $(B \times A = C \times A) \Rightarrow B = C$
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717554445670-->
|
<!--ID: 1718107987928-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
$(B \times A = C \times A) \Rightarrow B = C$ is always true if what condition is satisfied?
|
||||||
|
Back: $A \neq \varnothing$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987936-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
## Bibliography
|
## Bibliography
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
title: Closed Addressing
|
||||||
|
TARGET DECK: Obsidian::STEM
|
||||||
|
FILE TAGS: hashing::closed
|
||||||
|
tags:
|
||||||
|
- hashing
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
In **closed addressing**, a key is always stored in the bucket it's hashed to. Collisions are dealt with using separate data structures on a per-bucket basis.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does "closed" refer to in term "closed addressing"?
|
||||||
|
Back: A key is always stored in the slot it hashes to.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717474-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does "open" refer to in term "open hashing"?
|
||||||
|
Back: A key may resides in a data structure separate from the hash table.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717484-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
{Closed} addressing is also known as {open} hashing.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717495-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
The following is an example of {closed} addressing.
|
||||||
|
![[closed-addressing.png]]
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717506-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
The following is an example of {open} hashing.
|
||||||
|
![[closed-addressing.png]]
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198755496-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Bibliography
|
||||||
|
|
||||||
|
* “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
|
@ -121,6 +121,23 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
||||||
<!--ID: 1716307180987-->
|
<!--ID: 1716307180987-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What distinguishes direct addressing from closed and open addressing?
|
||||||
|
Back: Direct addressing isn't concerned with conflicting keys.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718199205862-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Direct addressing sits between what other addressing types?
|
||||||
|
Back: Open and closed addressing.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718199205872-->
|
||||||
|
END%%
|
||||||
|
|
||||||
## Bibliography
|
## Bibliography
|
||||||
|
|
||||||
|
* “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
* 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).
|
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
|
@ -137,6 +137,48 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
|
||||||
<!--ID: 1716307180980-->
|
<!--ID: 1716307180980-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
An **independent uniform hash function** is the ideal theoretical abstraction. For each possible input $k$ in universe $U$, an output $h(k)$ is produced randomly and independently chosen from range $\{0, 1, \ldots, m - 1\}$. Once a value $h(k)$ is chosen, each subsequent call to $h$ with the same input $k$ yields the same output $h(k)$.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What is considered the ideal (though only theoretical) hash function?
|
||||||
|
Back: The independent uniform hash function.
|
||||||
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1718197741507-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Given independent uniform hash function $h$, what about $h$ is "independent"?
|
||||||
|
Back: Each key $k$ has output $h(k)$ determined independently from other keys.
|
||||||
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1718197741527-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Given independent uniform hash function $h$, what about $h$ is "uniform"?
|
||||||
|
Back: Every output of $h$ is equally likely to be any of the values in its range.
|
||||||
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1718197741537-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
With respect to hashing, a random oracle refers to what kind of hash function?
|
||||||
|
Back: An independent uniform hash function.
|
||||||
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1718197741545-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Where does "memory" come into play with independent uniform hash functions?
|
||||||
|
Back: Once $h(k)$ is determined, subsequent calls to $h$ with $k$ always yield the same value.
|
||||||
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
|
<!--ID: 1718197741555-->
|
||||||
|
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).
|
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
title: Open Addressing
|
||||||
|
TARGET DECK: Obsidian::STEM
|
||||||
|
FILE TAGS: hashing::open
|
||||||
|
tags:
|
||||||
|
- hashing
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
In **open addressing**, keys always reside in the hash table. Collisions are dealt with by searching for other empty buckets within the hash table.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does "closed" refer to in term "closed hashing"?
|
||||||
|
Back: A key must reside in the hash table.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717434-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does "open" refer to in term "open addressing"?
|
||||||
|
Back: A key is not necessarily stored in the slot it hashes to.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717447-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
{Open} addressing is also known as {closed} hashing.
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717455-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
The following is an example of {closed} hashing.
|
||||||
|
![[open-addressing.png]]
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198717464-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
The following is an example of {open} addressing.
|
||||||
|
![[open-addressing.png]]
|
||||||
|
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
<!--ID: 1718198755486-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
## Bibliography
|
||||||
|
|
||||||
|
* “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
|
||||||
|
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
|
@ -621,8 +621,8 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Execution of `b[i] := e` of array $b$ yields what new value of $b$?
|
Execution of `b[i] := e` of array $b$ in state $s$ yields what new value of $b$?
|
||||||
Back: $b = (b; i{:}e)$
|
Back: $b = (b; i{:}s(e))$
|
||||||
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: 1713793130031-->
|
<!--ID: 1713793130031-->
|
||||||
END%%
|
END%%
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -255,6 +255,14 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
||||||
<!--ID: 1717372494462-->
|
<!--ID: 1717372494462-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Let $A$ and $B$ be sets. Proving the following is equivalent to showing what class is a set? $$\exists C, \forall y, (y \in C \Leftrightarrow y = \{x\} \times B \text{ for some } x \in A)$$
|
||||||
|
Back: $\{\{x\} \times B \mid x \in A\}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718105051820-->
|
||||||
|
END%%
|
||||||
|
|
||||||
## Empty Set Axiom
|
## Empty Set Axiom
|
||||||
|
|
||||||
There exists a set having no members: $$\exists B, \forall x, x \not\in B$$
|
There exists a set having no members: $$\exists B, \forall x, x \not\in B$$
|
||||||
|
|
|
@ -95,53 +95,130 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
||||||
<!--ID: 1717678753145-->
|
<!--ID: 1717678753145-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
Given two sets $A$ and $B$, the **Cartesian product** $A \times B$ is defined as: $$A \times B = \{\langle x, y \rangle \mid x \in A \land y \in B\}$$
|
A **relation** $R$ is a set of ordered pairs. The **domain** of $R$ ($\mathop{\text{dom}}{R}$), the **range** of $R$ ($\mathop{\text{ran}}{R}$), and the **field** of $R$ ($\mathop{\text{fld}}{R}$) is defined as:
|
||||||
|
|
||||||
|
* $x \in \mathop{\text{dom}}{R} \Leftrightarrow \exists y, \langle x, y \rangle \in R$
|
||||||
|
* $x \in \mathop{\text{ran}}{R} \Leftrightarrow \exists t, \langle t, x \rangle \in R$
|
||||||
|
* $\mathop{\text{fld}}{R} = \mathop{\text{dom}}{R} \cup \mathop{\text{ran}}{R}$
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
How is the Cartesian product of $A$ and $B$ denoted?
|
What is a relation?
|
||||||
Back: $A \times B$
|
Back: A set of ordered pairs.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717679397781-->
|
<!--ID: 1718107987764-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Using ordered pairs, how is $A \times B$ defined?
|
Are relations or sets the more general concept?
|
||||||
Back: $\{\langle x, y \rangle \mid x \in A \land y \in B\}$
|
Back: Sets.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717679397797-->
|
<!--ID: 1718107987776-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Who is attributed the representation of points in a plane?
|
How is the ordering relation $<$ on $\{2, 3, 5\}$ defined?
|
||||||
Back: René Descartes.
|
Back: As set $\{\langle 2, 3\rangle, \langle 2, 5 \rangle, \langle 3, 5 \rangle\}$.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717679397825-->
|
<!--ID: 1718107987783-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Why is the Cartesian product named the way it is?
|
How is the ordering relation $<$ on $\{2, 3, 5\}$ visualized?
|
||||||
Back: It is named after René Descartes.
|
Back:
|
||||||
Reference: “Cartesian Product,” in _Wikipedia_, April 17, 2024, [https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305](https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305).
|
![[relation-ordering-example.png]]
|
||||||
<!--ID: 1717679397836-->
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987794-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Suppose $x, y \in A$. What set is $\langle x, y \rangle$ in?
|
A relation is a set of ordered pairs with what additional restriction?
|
||||||
Back: $\mathscr{P}\mathscr{P}A$
|
Back: N/A.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717679397848-->
|
<!--ID: 1718107987803-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Cloze
|
Cloze
|
||||||
{$x \in A$} iff {$\{x\} \subseteq A$} iff {$\{x\} \in \mathscr{P}A$}.
|
For relation $R$, {$xRy$} is alternative notation for {$\langle x, y \rangle \in R$}.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1717679397860-->
|
<!--ID: 1718107987813-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is ordering relation $<$ on set $\mathbb{R}$ defined using set-builder notation?
|
||||||
|
Back: As $\{\langle x, y\rangle \in \mathbb{R} \times \mathbb{R} \mid x \text{ is less than } y\}$.
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987822-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is $x < y$ rewritten to emphasize that $<$ is a relation?
|
||||||
|
Back: $\langle x, y \rangle \in \;<$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987831-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the identity relation on $\omega$ defined using set-builder notation?
|
||||||
|
Back: $\{\langle n, n \rangle \mid n \in \omega\}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987840-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the domain of relation $R$ denoted?
|
||||||
|
Back: $\mathop{\text{dom}}{R}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987850-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the domain of relation $R$ defined?
|
||||||
|
Back: $x \in \mathop{\text{dom}}{R} \Leftrightarrow \exists y, \langle x, y \rangle \in R$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987862-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the range of relation $R$ denoted?
|
||||||
|
Back: $\mathop{\text{ran}}{R}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987872-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the range of relation $R$ defined?
|
||||||
|
Back: $x \in \mathop{\text{ran}}{R} \Leftrightarrow \exists t, \langle t, x \rangle \in R$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987880-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the field of relation $R$ denoted?
|
||||||
|
Back: $\mathop{\text{fld}}{R}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987887-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is the field of relation $R$ defined?
|
||||||
|
Back: $\mathop{\text{fld}}{R} = \mathop{\text{dom}}{R} \cup \mathop{\text{ran}}{R}$
|
||||||
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
|
<!--ID: 1718107987897-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
## Bibliography
|
## Bibliography
|
||||||
|
|
Loading…
Reference in New Issue