> For the complete documentation index, see [llms.txt](https://republic-of-cs.gitbook.io/e/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://republic-of-cs.gitbook.io/e/rcs.101/rcs.101.c.md).

# RCS.101.c

{% tabs %}
{% tab title="Map of Contents" %}

<figure><img src="https://550114503-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV9kHdumiUo1ODZRtnI76%2Fuploads%2Fq4yaWe2mv8Bb6YiPeafw%2Fimage.png?alt=media&amp;token=f6ab3f10-d408-4ee4-87ab-b2c2be3a487c" alt=""><figcaption><p>RCS.101.c</p></figcaption></figure>
{% endtab %}

{% tab title="Backtracking" %}
{% embed url="<https://www.youtube.com/watch?index=9&list=PLskIq2MzopHCU6IAoYtedpzOzgWItmmQI&v=bNqloQBMKls>" %}
\[RCS.101 x Miters] Backtracking (1)
{% endembed %}

{% embed url="<https://www.youtube.com/watch?index=10&list=PLskIq2MzopHCU6IAoYtedpzOzgWItmmQI&v=gWUAcA7qxng>" %}
\[RCS.101 x Miters] Backtracking (2)
{% endembed %}
{% endtab %}

{% tab title="Basic Graphs" %}
{% embed url="<https://www.youtube.com/watch?index=11&list=PLskIq2MzopHCU6IAoYtedpzOzgWItmmQI&v=MBIKqL7DGBc>" %}
\[RCS.101 x Miters] Basic Graphs (1)
{% endembed %}

{% embed url="<https://www.youtube.com/watch?index=12&list=PLskIq2MzopHCU6IAoYtedpzOzgWItmmQI&v=Ida7mTq3WOc>" %}
\[RCS.101 x Miters] Basic Graphs (2)
{% endembed %}
{% endtab %}

{% tab title="Heap" %}
{% embed url="<https://www.youtube.com/watch?index=13&list=PLskIq2MzopHCU6IAoYtedpzOzgWItmmQI&v=0XvKAmxAQkI>" %}
\[RCS.101 x Miters] Heap
{% endembed %}
{% endtab %}
{% endtabs %}

## Backtracking

* Learning Material
  * [**Princeton: Combinatorial Search**](https://algs4.cs.princeton.edu/lectures/keynote/67CombinatorialSearch.pdf)
    * [ ] **CodeForce:** [**Friendly Rooks**](https://codeforces.com/gym/103414/problem/A) (OJ for N-rooks problem)
  * [**Illinois: Backtracking**](https://courses.engr.illinois.edu/cs498374/fa2014/notes/07-backtracking.pdf)
  * [**LeetCode The Hard Way: Backtracking**](https://leetcodethehardway.com/tutorials/basic-topics/backtracking)

<table><thead><tr><th width="621">Practices</th><th></th></tr></thead><tbody><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/all-paths-from-source-to-target/"><strong>797. All Paths From Source to Target</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1234399777026867220"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/permutations/"><strong>46. Permutations</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1234400010758656042"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/letter-tile-possibilities/"><strong>079. Letter Tile Possibilities</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1234401518942294097"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/letter-combinations-of-a-phone-number/"><strong>17. Letter Combinations of a Phone Number</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1234401876263567392"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr></tbody></table>

<table><thead><tr><th width="621">Graduation Challenge</th><th></th></tr></thead><tbody><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/generate-parentheses/"><strong>22. Generate Parentheses</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1236875205784371260"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/combination-sum-iii/"><strong>216. Combination Sum III</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1236875418716344361"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>H</strong> <a href="https://leetcode.com/problems/n-queens/"><strong>51. N-Queens</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1236878787568992326"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr><tr><td><ul class="contains-task-list"><li><input type="checkbox"><strong>M</strong> <a href="https://leetcode.com/problems/numbers-with-same-consecutive-differences/"><strong>967. Numbers With Same Consecutive Differences</strong></a></li></ul></td><td><span data-gb-custom-inline data-tag="emoji" data-code="1f449">👉</span> <a href="https://discord.com/channels/1127379397578600553/1236879181631983688"><mark style="color:purple;"><strong>Forum</strong></mark></a></td></tr></tbody></table>

***

## Basic Graphs

{% hint style="info" %}
**Trees**

Trees are a common non-linear data structure. They don’t store data in a linear way, but instead organize hierarchically. A tree is normally represented by nodes which contain a value and point to other nodes.

#### Learning Material

* [**Google Tech Dev Guide: Trees**](https://techdevguide.withgoogle.com/paths/data-structures-and-algorithms/#sequence-3)
  {% endhint %}

* Learning Material
  * [**LeetCode The Hard Way: Graph Theory**](https://leetcodethehardway.com/tutorials/graph-theory/introduction)
  * [**LintCode: 第二章：数据结构（上）之并查集与字典树**](https://www.lintcode.com/course/7)
  * [**Disjoint Set**](https://leetcode.com/explore/featured/card/graph/618/disjoint-set/3881/)**,** [**CodeForce: UnionFind**](https://codeforces.com/blog/entry/98275)\
    (aka **Disjoint Set Union, DSU, UnionFind**)

    [**Quick Find**](https://leetcode.com/explore/featured/card/graph/618/disjoint-set/3878/), [**Quick Union**](https://leetcode.com/explore/featured/card/graph/618/disjoint-set/3840/)

    * [ ] **E** [**1971. Find if Path Exists in Graph**](https://leetcode.com/problems/find-if-path-exists-in-graph/)
    * [ ] **E** [**Number of Islands**](https://www.lintcode.com/problem/433/?showListFe=true\&page=1\&problemTypeId=2\&tagIds=399\&ordering=level\&pageSize=50)
  * [**Google Tech Dev Guide: Graphs**](https://techdevguide.withgoogle.com/paths/data-structures-and-algorithms/#sequence-6)

* Practices
  * [ ] **M** [**105. Construct Binary Tree from Preorder and Inorder Traversal**](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)
  * [ ] **M** [**178 · Graph Valid Tree**](https://www.lintcode.com/problem/178/description)
  * [ ] **M** [**128. Longest Consecutive Sequence**](https://leetcode.com/problems/longest-consecutive-sequence/)
  * [ ] **M** [**990. Satisfiability of Equality Equations**](https://leetcode.com/problems/satisfiability-of-equality-equations/)

* Graduation Challenge
  * [ ] 能答出 Undirected graphs, Directed graphs, Weighted graphs, Cyclic graphs, Acyclic Graph 的區別
  * [ ] **M** [**1202. Smallest String With Swaps**](https://leetcode.com/problems/smallest-string-with-swaps/)
  * [ ] **M** [**547. Number of Provinces**](https://leetcode.com/problems/number-of-provinces/)
  * [ ] **M** [**1319. Number of Operations to Make Network Connected**](https://leetcode.com/problems/number-of-operations-to-make-network-connected/)

***

## Heap

{% hint style="info" %}
A heap is a tree-based data structure that usually comes in two varieties: (1) Max-heaps where the the value in any node is greater than all the values in it's child nodes and (2) Min-heaps where the value in any node is less than all of the values in it's child nodes.

#### Learning Material

* [**LeetCode the Hard Way: Heap (Priority Queue)**](https://leetcodethehardway.com/tutorials/basic-topics/heap)
  * [ ] **E** [**1046. Last Stone Weight**](https://leetcode.com/problems/last-stone-weight/)
  * [ ] **E** [**464 · Sort Integers II**](https://www.lintcode.com/problem/464/description) with Heap Sort

* [**Google Tech Dev Guide: Heaps**](https://techdevguide.withgoogle.com/paths/data-structures-and-algorithms/#sequence-5)
  {% endhint %}

* Practices
  * [ ] **E** [**2974. Minimum Number Game**](https://leetcode.com/problems/minimum-number-game/)
  * [ ] **E** [**506. Relative Ranks**](https://leetcode.com/problems/relative-ranks/)
  * [ ] **M** [**2336. Smallest Number in Infinite Set**](https://leetcode.com/problems/smallest-number-in-infinite-set/)

* Graduation Challenge
  * [ ] **E** [**1464. Maximum Product of Two Elements in an Array**](https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/)
  * [ ] **E** [**1337. The K Weakest Rows in a Matrix**](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/)
  * [ ] **M** [**451. Sort Characters By Frequency**](https://leetcode.com/problems/sort-characters-by-frequency/)
  * [ ] **M** [**1845. Seat Reservation Manager**](https://leetcode.com/problems/seat-reservation-manager/)
