From 9ee37c8b7d21a48cf63cf5648b2eff222b55155f Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Thu, 25 Apr 2024 18:01:06 -0600 Subject: [PATCH] Refine notes on complete/perfect trees. --- .../plugins/obsidian-to-anki-plugin/data.json | 22 +- notes/_journal/{ => 2024-04}/2024-04-24.md | 3 +- notes/_journal/2024-04/2024-04-25.md | 15 + notes/algebra/sequences/index.md | 76 +- notes/algorithms/heaps.md | 12 + notes/c17/strings.md | 2 +- notes/set/images/complete-tree.png | Bin 0 -> 7770 bytes notes/set/images/non-complete-tree.png | Bin 0 -> 7749 bytes notes/set/images/perfect-tree.png | Bin 0 -> 8772 bytes notes/set/trees.md | 808 ++++++++++++------ 10 files changed, 678 insertions(+), 260 deletions(-) rename notes/_journal/{ => 2024-04}/2024-04-24.md (87%) create mode 100644 notes/_journal/2024-04/2024-04-25.md create mode 100644 notes/algorithms/heaps.md create mode 100644 notes/set/images/complete-tree.png create mode 100644 notes/set/images/non-complete-tree.png create mode 100644 notes/set/images/perfect-tree.png diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index 76712d8..10bbf8a 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -109,7 +109,12 @@ "rooted-tree.png", "ordered-rooted-tree.png", "ordered-rooted-tree-cmp.png", - "ordered-binary-tree-cmp.png" + "ordered-binary-tree-cmp.png", + "complete-tree.png", + "nearly-complete-tree.png", + "non-nearly-complete-tree.png", + "perfect-tree.png", + "non-complete-tree.png" ], "File Hashes": { "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", @@ -221,10 +226,10 @@ "_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7", "_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd", "_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b", - "c17/strings.md": "e4012ee9a18ad44370490e375ae57f09", + "c17/strings.md": "8f23005c9f8e25c72e2ac6b74b6afd7e", "c17/index.md": "78576ee41d0185df82c59999142f4edb", "c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500", - "c17/declarations.md": "7556186be0678419100ee9801e85ff06", + "c17/declarations.md": "7d45d1b415b66916dbb908f51d034b72", "algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd", "_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4", "_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7", @@ -246,7 +251,7 @@ "_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe", "_journal/2024-02/2024-02-29.md": "0e502a2c8baf90c2f12859b03f10b5a1", "algebra/sequences.md": "97c217823aacf8910a1a37bde694ecfe", - "algebra/sequences/index.md": "a15b7ce8cd040a08c7bfc8ceb6cd0525", + "algebra/sequences/index.md": "06df0fd12c2367995037ec4c26c51a53", "_journal/2024-03-02.md": "08c3cae1df0079293b47e1e9556f1ce1", "_journal/2024-03/2024-03-01.md": "70da812300f284df72718dd32fc39322", "algebra/sequences/triangular-numbers.md": "39a84ee317d3760a2eda7279c83e921a", @@ -310,7 +315,7 @@ "x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2", "x86-64/instructions.md": "d783bad8dd77748fb412715541cb844d", "git/refs.md": "954fc69004aa65b358ec5ce07c1435ce", - "set/trees.md": "4d081c258eb662e2147d1e462193e715", + "set/trees.md": "6c1a245f6b25838c519f5c9bcf96c369", "_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6", "_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b", "_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9", @@ -362,8 +367,11 @@ "_journal/2024-04/2024-04-20.md": "043bbf73e6a317152b8fa3af03d1c57b", "_journal/2024-04-23.md": "a138b94e4c986773f30b3f2b375d3216", "_journal/2024-04/2024-04-22.md": "1737cfe64dca349f7ea3401863555d90", - "_journal/2024-04-24.md": "388aea1c0dc33bccef57c070bf59da4d", - "_journal/2024-04/2024-04-23.md": "010539ad366ed628faa6db384a8e4bd2" + "_journal/2024-04-24.md": "4cb04e0dea56e0b471fc0e428471a390", + "_journal/2024-04/2024-04-23.md": "20514052da91b06b979cacb3da758837", + "_journal/2024-04-25.md": "10c98531cb90a6bc940ea7ae3342f98b", + "_journal/2024-04/2024-04-24.md": "4cb04e0dea56e0b471fc0e428471a390", + "algorithms/heaps.md": "4235ec90b6e251fc992906e0f1fe69e7" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-04-24.md b/notes/_journal/2024-04/2024-04-24.md similarity index 87% rename from notes/_journal/2024-04-24.md rename to notes/_journal/2024-04/2024-04-24.md index fc87e89..1ef14b8 100644 --- a/notes/_journal/2024-04-24.md +++ b/notes/_journal/2024-04/2024-04-24.md @@ -15,4 +15,5 @@ title: "2024-04-24" * Explored how to limit the number of re-renders in the application. * Played around with Zustand types to get TypeScript and Immer working together (WIP). * Read chapter 2 "Pastebin" of "Grokking the System Design Interview". -* Read chapter 4 of HP-16C manual. \ No newline at end of file +* Read chapter 4 of HP-16C manual. +* Add notes on iterating recurrence relations. \ No newline at end of file diff --git a/notes/_journal/2024-04/2024-04-25.md b/notes/_journal/2024-04/2024-04-25.md new file mode 100644 index 0000000..5bee09b --- /dev/null +++ b/notes/_journal/2024-04/2024-04-25.md @@ -0,0 +1,15 @@ +--- +title: "2024-04-25" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) +- [x] Interview Prep (1 Practice Problem) +- [x] Log Work Hours (Max 3 hours) + +* Talk with Mike about yesterday's "Grokking the System Interview" and "Designing Data-Intensive Applications" reading. +* Notes on nearly complete trees. Refine terminology to favor "perfect/complete" over "complete/nearly complete". +* Read Heapsort section in "Introduction to Algorithms". Still need to implement and translate into notes though. \ No newline at end of file diff --git a/notes/algebra/sequences/index.md b/notes/algebra/sequences/index.md index ef07825..68a9de6 100644 --- a/notes/algebra/sequences/index.md +++ b/notes/algebra/sequences/index.md @@ -171,6 +171,12 @@ END%% ## Solving Recurrence Relations +We use three different strategies for solving recurrences: + +* Telescoping +* Iteration +* Characteristic Polynomials + %%ANKI Basic What is the recurrence relation for the Fibonacci sequence? @@ -245,15 +251,14 @@ END%% %%ANKI Basic -Schematically show how telescoping can be used to solve $a_n = a_{n-1} + f(n)$. +Schematically show how **telescoping** can be used to solve $a_n = a_{n-1} + f(n)$. Back: $$\begin{align*} a_1 - a_0 & = f(1) \\ & \vdots \\ a_n - a_{n-1} & = f(n) \\ \hline a_n - a_0 & = \sum_{k=1}^n f(k) -\end{align*}$$ -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{align*}$$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%% @@ -273,6 +278,71 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n END%% +%%ANKI +Basic +What does it mean to solve a recurrence relation using iteration? +Back: Repeatedly expand terms, starting at the initial conditions, to discover a pattern. +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 result of "iterating" the following recursive definition twice? $$a_n = 3a_{n-1} + 2$$ +Back: $$\begin{align*} +a_1 & = 3(a_0) + 2 \\ +a_2 & = 3(3(a_0) + 2) + 2 +\end{align*}$$ +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 +Schematically show how **iteration** can be used to solve $a_n = a_{n-1} + f(n)$. +Back: $$\begin{align*} +a_1 & = a_0 + f(1) \\ +& \vdots \\ +a_n & = (\cdots((a_0 + f(1)) + f(2)) + \cdots) + f(n) \\ +\hline +a_n & = a_0 + \sum_{k=1}^n f(k) +\end{align*}$$ +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 fast does the number of terms grow when iterating $a_n = 3a_{n-1} + 2$? +Back: Linearly. +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 fast does the number of terms grow when iterating $a_n = 2a_{n-1} + 3a_{n-2}$? +Back: Exponentially (the number of terms double each iteration). +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 should you avoid using iteration to solve $a_n = 2a_{n-1} + 3a_{n-2}$? +Back: The number of terms grows unwieldy very quickly. +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 +When solving recurrences, is telescoping or iteration a more general technique? +Back: Iteration. +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%% + ## Bibliography * 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/algorithms/heaps.md b/notes/algorithms/heaps.md new file mode 100644 index 0000000..556c59e --- /dev/null +++ b/notes/algorithms/heaps.md @@ -0,0 +1,12 @@ +--- +title: Heaps +TARGET DECK: Obsidian::STEM +FILE TAGS: algorithm::data_structure +tags: + - algorithm + - data_structure +--- + +## Overview + +TODO \ No newline at end of file diff --git a/notes/c17/strings.md b/notes/c17/strings.md index 4c946b7..716b795 100644 --- a/notes/c17/strings.md +++ b/notes/c17/strings.md @@ -36,7 +36,7 @@ END%% %%ANKI Basic -Text is more platform-independent than binary because it is unaffected by what two properties? +Text is more platform-independent than e.g. integer encodings because it is unaffected by what two properties? Back: Word size and byte ordering. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. diff --git a/notes/set/images/complete-tree.png b/notes/set/images/complete-tree.png new file mode 100644 index 0000000000000000000000000000000000000000..09b254d899e331917013586220ef363d7cb44225 GIT binary patch literal 7770 zcmZvB2UJtd);7HgNKg<6O%j@PkS-v-H$g#=A|wdXJJN}OK|qQSs#NK{_bLL?4I&^N z=~Y9o|H1cO*MGnDX02rJ%*>hd%-%D5o|%o*(NZQOp(DY%TH(BUi&wF7Z|_h?y^z;YgbGql~3;3D=pt!q|d@a}P=a$t$4K*Dms&hTi_ z3J*RJ(I@9_e)~nT#dXae=FQpz_n@j!X?8}@_25tMG*A!xElu2#ER&j(REMcBpX4eK z%jA#Ma+RbM!3Ou!em4~Na4qqCe)=)DdZ*9yPT%IeevLfwUu9wm;|n2r*@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}&+&)HilspjO=n_Jt}FrMg}#Bn`c_id1#s9RMd|N3mI=PpjrUf|!tSE79ts(LgFvEE zyIbl!vqLTO+$$*HPRWx^!~-9D=+f5(CBN3WZ$4+*ntu<5jrW=Q^ySXN23Np&$*yz* zP#|e`6SYid5cDs3v;R%2UFX?=48cEHx4&t%>w-U7xBsT$f`hIoa+McNmg8x+ffOT_ Ns-l)cshoN6{{!8h#CHGy literal 0 HcmV?d00001 diff --git a/notes/set/images/non-complete-tree.png b/notes/set/images/non-complete-tree.png new file mode 100644 index 0000000000000000000000000000000000000000..ca23d9c1fb3d6d7b643b5fadef3fb4568bb01a70 GIT binary patch literal 7749 zcmaKR1yodB*FPYQgp@SWNH>Ud4@kGP($Wk)fV4R)z-jSQuTbW&8*0Vpay^6+xEcXF{qL*q;iPL@{dlcVdmno?Kh3b)ts{GyY)S5%bP zh_4JGagH*gA64xt04S!cuXDCg(p{NUNw!G*++F3u4QG5bPNemgPjCG;MInxgIPvoE zU>SZu-!01Z);?r$uaB)9-_6xYK6Rz)QE?Bo~k8-mC*km{u#CO6!zk8M;9rDr~2!07}2LoVazdkF} zM{E!osh6opDbpE><{q_H4RXPG2cDOfH5?3CQVsp&9(h*&B%GD99`gZ)?X->xme`Ai z-4YYEsgT}5*}V&8uc04YicEtT6%&tIL+WJDmZ}XibC4;_cm+TEJ!MqFkbDzWPsdN| z;Ue0vSA{)Fo3CfE1ug-B9o5S3UU#~#u79c?3hLe<5;(I}EBm1?pJiT%)}B8pzVSND ztiWOHXLaMdDV#@&7Nu^lBNVNx)aHK5APx@p_E&_fZ$i+<>%B%m7tGqIuwcK?P*p-n z)OD`d7K##h9%`oEXlQ&acRzIhQdwV=5(fy-RL0rHq^3X<)^JaFh*D7ll}&((?yjzO zZa_3eFFPBco$Vt(C!pgaRe+|BaTpQGh>jkhByZq9zn>dmkp3-qP!_kS3f=C(@CYXt zzq2xCmO++^CM#H^J}}TLD|55q<<|y4YLhJj2-soWnP#u|EzA2}MxD)PIxkG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U_%2N9We-+Q#UPo zH{a$fg7h{7(q>abY!t|kwU`7nBo4JmA5xv9B;W=HgPID&bq8)VU9^P;NX@ON?e=S1 zj00Q7k$@(+D?vN=Z)-LEs=NCxE--@a(02iEW5~+Uxi>I2?O~}(6-b{#Y;XC7p*F)sH`d0)gI|o*osTY?PSfR1#S^Bcti~4& z`r)MZkY9LlDa^;DuH}OLCCDSSBq?FAI?$l_Qb*6$@-QRwMgHpt`jYj@QQFpImuRM_tK?3j<~sjmp=)5N0vWFsyTl(FS?xJ3GtFO3qO6k zuRf$%H;?!zvzZ%5IagO5!C}450zxB%l#Mk-)7hvK=hC%r8`%$F{*E(pD@~iKE?-)T zkJLC3iciu{usJdz$e&elZo&|=e*S|bIA3vZrKLyETQQr|N2PT*zY0HclqtQyAwThM zC7h(ccM38xV|s@GN3gs>t*vL)1t~OgsXU$cv}U#Z!8iPHe$-!G<~vMc;$2rg=umw| zKk;K8M^`NM;;6SMp^lj772WjyM=H9s7o*_sM@23a8v45#2Hv+FCxJvR`mOne&mJ%okGG(LF>x#To>yO= z=HXVlnT%NfGckV}mSg?b#Qe{&{QpkO{~52>5WZ>yzA%9G^j(0zN9__^$B)k}*aSld Ty||YE9E_}_qC~lvVZi?bXw(g5 literal 0 HcmV?d00001 diff --git a/notes/set/trees.md b/notes/set/trees.md index ab8c288..e157c51 100644 --- a/notes/set/trees.md +++ b/notes/set/trees.md @@ -1,10 +1,11 @@ --- title: Trees TARGET DECK: Obsidian::STEM -FILE TAGS: set::graph +FILE TAGS: set::tree tags: - graph - set + - tree --- ## Overview @@ -153,6 +154,22 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% +%%ANKI +Basic +How many levels exist in a rooted tree of height $h$? +Back: $h + 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the height of a rooted tree with $k$ levels? +Back: $k - 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + %%ANKI Basic Which free trees are not considered rooted trees? @@ -644,16 +661,16 @@ END%% %%ANKI Basic -The following two trees are equivalent when considered as what kind of trees? +The following two trees are equivalent when considered as what (most specific) kind of trees? ![[ordered-rooted-tree-cmp.png]] -Back: Rooted/free trees. +Back: Rooted trees. Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). END%% %%ANKI Basic -The following two trees are different when considered as what kind of trees? +The following two trees are different when considered as what (most general) 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). @@ -678,6 +695,15 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% +%%ANKI +Basic +Considered as positional 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). + +END%% + %%ANKI Basic Considered as binary trees, are the following trees the same? @@ -687,13 +713,541 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% -### Binary Trees +%%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). + +END%% + +### Positional Trees + +A **positional tree** is a rooted tree in which each child is labeled with a specific positive integer. A **$k$-ary tree** is a positional tree with at most $k$ children/labels. A binary tree is a $2$-ary tree. + +A $k$-ary tree is **full** if every node has degree $0$ or $k$. A $k$-ary tree is **perfect** if all leaves have the same depth and all internal nodes have degree $k$. A $k$-ary tree is **complete** if the last level is not filled but all leaves have the same depth and are leftmost arranged. + +%%ANKI +Basic +Why aren't terms "complete/perfect" and "nearly complete/complete" quite synonymous? +Back: In the former, "perfect" trees are a subset of "complete" trees. +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% + +%%ANKI +Basic +What distinguishes a positional tree from a $k$-ary tree? +Back: A $k$-ary tree cannot have child with label $> k$. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is a $k$-ary tree a positional tree? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is a positional tree a $k$-ary tree? +Back: Not necessarily. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What distinguishes positional trees from ordered trees? +Back: Children of the former are labeled with a distinct positive integer. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the notion of absent children a concept in ordered trees? +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the notion of absent children a concept in positional trees? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the notion of absent children a concept in $k$-ary trees? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a positional tree? +Back: A rooted tree in which each child is labeled with a distinct positive integer. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is a $k$-ary tree? +Back: A positional tree with labels greater than $k$ missing. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which of positional trees or $k$-ary trees are more general? +Back: The positional tree. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which of positional trees or ordered trees are more general? +Back: N/A. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Is the concept of fullness related to positional trees or $k$-ary trees? +Back: $k$-ary trees. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +Basic +Is the concept of perfectness related to positional trees or $k$-ary trees? +Back: $k$-ary trees. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the concept of completeness related to positional trees or $k$-ary trees? +Back: $k$-ary trees. +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 $k$-ary tree to be full? +Back: Each node has $0$ or $k$ children. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What degrees are permitted in a full $k$-ary tree? +Back: $0$ or $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What degrees are permitted in a perfect $k$-ary tree? +Back: $0$ or $k$ +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 $k$-ary tree to be perfect? +Back: All leaves have the same depth and all internal nodes have degree $k$. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the degree of an internal node in a perfect $k$-ary tree? +Back: $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the degree of an external node in a perfect $k$-ary tree? +Back: $0$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What recursive definition describes the number of nodes in each level of a perfect $k$-ary tree? +Back: $a_n = k \cdot a_{n-1}$ with $a_0 = 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many nodes are in a perfect $k$-ary tree of height $h$? +Back: $$\frac{1 - k^{h+1}}{1 - k}$$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many internal nodes are in a perfect $k$-ary tree of height $h$? +Back: $$\frac{1 - k^h}{1 - k}$$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many external nodes are in a perfect $k$-ary tree of height $h$? +Back: $k^h$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many nodes are on level $d$ of a perfect $k$-ary tree? +Back: $k^d$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What kind of sequence describes the number of nodes in a perfect $k$-ary tree? +Back: A geometric sequence. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What is the common ratio of the geometric sequence used to count nodes of a perfect $k$-ary tree? +Back: $k$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +What does it mean for a $k$-ary tree to be complete? +Back: The last level is not filled but all leaves have the same depth and are leftmost arranged. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How is the minimum number of nodes in a complete $k$-ary tree of height $h$ calculated in terms of perfect $k$-ary trees? +Back: As "the number of nodes in a perfect $k$-ary tree of height $h - 1$" plus $1$. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the maximum number of nodes in a complete binary tree of height $h$? +Back: $2^{h+1} - 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How is the maximum number of nodes in a complete $k$-ary tree of height $h$ calculated in terms of perfect $k$-ary trees? +Back: As "the number of nodes in a perfect $k$-ary tree of height $h$". +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +#### Binary Trees 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 +Is a binary tree a $k$-ary tree? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is a binary tree a positional tree? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +END%% + +%%ANKI +Basic +Is a binary tree an ordered tree? +Back: No. +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 binary tree to be full? +Back: Each node has $0$ or $2$ children. +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 binary tree to be perfect? +Back: Each leaf has the same depth and all internal nodes have degree $2$. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is a perfect binary tree considered full? +Back: Yes. +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% + +%%ANKI +Basic +Is a full binary tree considered perfect? +Back: Not necessarily. +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% + +%%ANKI +Basic +Is a full binary tree considered complete? +Back: Not necessarily. +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% + +%%ANKI +Basic +Is a complete binary tree considered full? +Back: Not necessarily. +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% + +%%ANKI +Basic +What alternative term is sometimes used in favor of a "perfect binary tree"? +Back: A "complete binary tree". +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% +%%ANKI +Basic +What alternative term is sometimes used in favor over a "complete binary tree"? +Back: Some authors may say "nearly complete" if the last level isn't completely filled. +Reference: “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). + +END%% + +%%ANKI +Basic +What degrees are permitted in a full binary tree? +Back: $0$ or $2$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What degrees are permitted in a perfect binary tree? +Back: $0$ or $2$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What category of rooted tree does a binary tree fall under? +Back: A positional tree or $k$-ary tree. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is a binary tree a positional tree? +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +How many nodes are in a perfect binary tree of height $h$? +Back: $2^{h+1} - 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many internal nodes are in a perfect binary tree of height $h$? +Back: $2^h - 1$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many external nodes are in a perfect binary tree of height $h$? +Back: $2^h$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How many nodes are on level $d$ of a perfect binary tree? +Back: $2^d$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +How does the number of internal nodes compare to the number of external nodes in a perfect binary tree? +Back: There is one more external node than internal node. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). +Tags: algebra::sequence + +END%% + +%%ANKI +Basic +Is the following a perfect binary tree? +![[perfect-tree.png]] +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a complete binary tree? +![[perfect-tree.png]] +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a full binary tree? +![[perfect-tree.png]] +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a perfect binary tree? +![[complete-tree.png]] +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a complete binary tree? +![[complete-tree.png]] +Back: Yes. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a full binary tree? +![[complete-tree.png]] +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a perfect binary tree? +![[non-complete-tree.png]] +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a complete binary tree? +![[non-complete-tree.png]] +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Is the following a full binary tree? +![[non-complete-tree.png]] +Back: No. +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What is the minimum number of nodes in a complete binary tree of height $h$? +Back: $2^h$ +Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + %%ANKI Basic What is the base case used in the recursive definition of a binary tree? @@ -812,249 +1366,7 @@ Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition END%% -%%ANKI -Is a binary tree a $k$-ary tree? -Back: Yes. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -ANKI%% -Is a $k$-ary tree a positional tree? -Back: Yes. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -ANK%% -Is a positional tree a $k$-ary tree? -Back: Not necessarily. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -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). - -END%% - -### Positional Trees - -A **positional tree** is a rooted tree in which each child is labeled with a specific positive integer. A **$k$-ary tree** is a positional tree with at most $k$ children/labels. A binary tree is a $2$-ary tree. - -A $k$-ary tree is **full** if every node has degree $0$ or $k$. A $k$-ary tree is **complete** if all leaves have the same depth and all internal nodes have degree $k$. - -%%ANKI -Basic -What does it mean for a binary tree to be full? -Back: Each node has $0$ or $2$ children. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -What does it mean for a binary tree to be complete? -Back: Each leaf has the same depth and all internal nodes have degree $2$. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -%%ANKI -What degrees are permitted in a full binary tree? -Back: $0$ or $2$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -%%ANKI -What degrees are permitted in a complete binary tree? -Back: $0$ or $2$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -%%ANKI -What category of rooted tree does a binary tree fall under? -Back: A positional tree or $k$-ary tree. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -%%ANKI -Basic -What distinguishes a positional tree from a $k$-ary tree? -Back: A $k$-ary tree is a positional tree in which each node has at most $k$ children. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What distinguishes positional trees from ordered trees? -Back: The same children in different positions is considered distinct in the former. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What is a positional tree? -Back: A rooted tree in which each child is labeled with a specific positive integer. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What is a $k$-ary tree? -Back: A positional tree in which each node has $k$ labels with a potential child. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -Which of positional trees or $k$-ary trees are more general? -Back: The positional tree. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -Which of positional trees or $k$-ary trees are more general? -Back: The positional tree. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -%%ANKI -Basic -Is a binary tree a positional tree? -Back: Yes. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Is the concept of fullness related to positional trees or $k$-ary trees? -Back: $k$-ary trees. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -END%% - -%%ANKI -Basic -Is the concept of completeness related to positional trees or $k$-ary trees? -Back: $k$-ary trees. -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 $k$-ary tree to be full? -Back: Each node has $0$ or $k$ children. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What degrees are permitted in a full $k$-ary tree? -Back: $0$ or $k$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What degrees are permitted in a complete $k$-ary tree? -Back: $0$ or $k$ -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 $k$-ary tree to be complete? -Back: All leaves have the same depth and all internal nodes have degree $k$. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What is the degree of an internal node in a complete $k$-ary tree'? -Back: $k$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What is the degree of an external node in a complete $k$-ary tree'? -Back: $0$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -How many levels exist in a rooted tree of height $h$? -Back: $h + 1$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What is the height of a rooted tree with $k$ levels? -Back: $k - 1$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). - -END%% - -%%ANKI -Basic -What recursive definition describes the number of nodes in each level of a complete $k$-ary tree? -Back: $a_n = k \cdot a_{n-1}$ with $a_0 = 1$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -Tags: algebra::sequence - -END%% - -%%ANKI -Basic -What closed formula details the number of nodes in a complete $k$-ary tree of height $h$? -Back: $$\frac{1 - k^h}{1 - k}$$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -Tags: algebra::sequence - -END%% - -%%ANKI -Basic -What kind of sequence describes the number of nodes in a complete $k$-ary tree? -Back: A geometric sequence. -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -Tags: algebra::sequence - -END%% - -%%ANKI -Basic -What is the common ratio in the geometric sequence counting nodes of a complete $k$-ary tree? -Back: $k$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -Tags: algebra::sequence - -END%% - -%%ANKI -Basic -How many nodes are in a complete binary tree of height $h$? -Back: $$\frac{1 - 2^h}{1 - 2} = 2^h - 1$$ -Reference: Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). -Tags: algebra::sequence - -END%% - ## Bibliography +* “Binary Tree,” in _Wikipedia_, March 13, 2024, [https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees](https://en.wikipedia.org/w/index.php?title=Binary_tree&oldid=1213529508#Types_of_binary_trees). * Thomas H. Cormen et al., _Introduction to Algorithms_, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).