An open API service indexing awesome lists of open source software.

https://github.com/rurangiza/dojo

Learning data structures and algorithms
https://github.com/rurangiza/dojo

algorithms data-structures

Last synced: over 1 year ago
JSON representation

Learning data structures and algorithms

Awesome Lists containing this project

README

          

# Welcome to the Dojo

![](./docs/Room_of_Spirit_and_Time.png)

## Data Structures & Algorithms
- [x] [Introduction to Data Structures](https://www.youtube.com/watch?v=X8h4dq9Hzq8)
- [x] [Introduction to Algorithms](https://www.youtube.com/live/4oqjcKenCH8?si=58ALyCO1klKIUVnm)
- [x] [What is a brute-force method](https://www.youtube.com/watch?v=kdTpUjd71G8)?
- [x] [Big-O Notation](https://youtu.be/BgLTDT03QtU?si=wU584KDbMbWFgak3)

> [!Important]
> For each data structure, algorithm and technique, do the following:
> learn the theory and concepts, then implement it in code and finally solve **5 easy** problems.

|||||
|-|:-|:-:|:-:|
||**Data Structures**: way of organizing data for easier processing|**Theory & Implementation**|**Exercices**|
|

  • - [x]
|[Dynamic Arrays](https://en.wikipedia.org/wiki/Dynamic_array): order is important, fast read, fast back insert|[C](./src/theory/data_structures/vector.c) - [Python](./src/theory/data_structures/vector.py)|[Leetcode](https://leetcode.com/tag/array/)|
|
  • - [x]
|[Linked-List](https://en.wikipedia.org/wiki/Linked_list): order not important, sequence matters, fast front/mid insert|[C](./src/theory/data_structures/singly-linked-list.c) - [Python](./src/theory/data_structures/singly-linked-list.py)|[Leetcode](https://leetcode.com/tag/linked-list/)|
|
  • - [x]
|[Stack](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)): frequent insert and remove at end = LIFO|[Python](./src/theory/data_structures/stack.ipynb)|[Leetcode](https://leetcode.com/tag/stack/)|
|
  • - [x]
|[Queues](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)): frequent insert at end and remove from front = FIFO|[Python](./src/theory/data_structures/deque.ipynb)|[Leetcode](https://leetcode.com/tag/queue/)|
|
  • - [x]
|[Hash Tables](https://en.wikipedia.org/wiki/Hash_table): order not important, no duplicates, fast read/write/search|[Notes](./src/theory/data_structures/hashmap.ipynb)|[Leetcode](https://leetcode.com/tag/hash-table/)|
|
  • - [ ]
|[Sets](https://en.wikipedia.org/wiki/Set_(abstract_data_type)): order not important, no duplicates, fast read/write/search, great to compare groups|||
|||||
||**Algorithms**: step by step instructions for completing a task|**Theory & Implementation**|**Exercices**|
|
  • - [ ]
|[Selection Sort](https://en.wikipedia.org/wiki/Selection_sort), [Bubble Sort](https://en.wikipedia.org/wiki/Bubble_sort), [Insertion Sort](https://www.youtube.com/watch?v=JU767SDMDvA) O(n^2)|[Notes](./src/theory/algorithms/sorting-quadratic.ipynb)|[Leetcode](https://leetcode.com/tag/heap-priority-queue/)|
|
  • - [ ]
|[Merge Sort](https://www.youtube.com/watch?v=4VqmGXwpLqc), [Quick Sort](https://youtu.be/Hoixgm4-P4M?si=OUJ7I-78ubkbnJtp) O(nlogn)|[Notes](./src/theory/algorithms/sorting-nlogn.ipynb)|[Leetcode](https://leetcode.com/tag/sorting/)|
|
  • - [ ]
|[Counting Sort](https://en.wikipedia.org/wiki/Counting_sort) [[2](https://www.youtube.com/watch?v=ZcUdXuzOzeU)] O(n) for limited range!|[Notes](./src/theory/algorithms/counting-sort.ipynb)|[Leetcode](https://leetcode.com/tag/counting-sort/)|
|
  • - [ ]
|[Bucket Sort](https://en.wikipedia.org/wiki/Bucket_sort) [[2](https://www.youtube.com/watch?v=rNdTWHQMvOk)] ||[Leetcode](https://leetcode.com/tag/bucket-sort/)|
|
  • - [x]
|[Binary Search](https://youtu.be/fDKIpRe8GW4?si=WGFySWh7-3bU_iPX)|[Python](./src/theory/algorithms/binary-search.ipynb)|[Leetcode](https://leetcode.com/tag/binary-search/)|
|||||
||**Techniques**: common ways of approaching common problems|**Theory & Implementation**|**Exercices**|
|
  • - [ ]
|[Two Pointers](https://www.youtube.com/watch?v=-gjxg6Pln50)||[Leetcode](https://leetcode.com/tag/two-pointers/)|
|
  • - [ ]
|[Prefix Sum](https://www.youtube.com/watch?v=7pJo_rM0z_s)||[Leetcode](https://leetcode.com/tag/prefix-sum/)|
|
  • - [ ]
|[Sliding Window](https://www.youtube.com/watch?v=p-ss2JNynmw)||[Leetcode](https://leetcode.com/tag/sliding-window/)|
|||||
||**Concepts**|**Theory & Concepts**|**Exercices**|
|
  • - [ ]
|[Recursion](https://youtube.com/playlist?list=PLgUwDviBIf0rGlzIn_7rsaR2FQ5e6ZOL9&si=nf1SDr2ndMU5ENWB): function calling itself, required for trees, backtracking and dynamic programming||[Exercices](https://leetcode.com/tag/recursion/)|
|
  • - [ ]
|[Bit Manipulation](https://youtu.be/NLKQEOgBAnw?si=oVl3SgLRvITKuN7x): fast operates without extra space required||[Exercices](https://leetcode.com/tag/bit-manipulation/)|
|
  • - [ ]
|[Regular Expressions](https://youtu.be/NLKQEOgBAnw?si=oVl3SgLRvITKuN7x) / [2](https://realpython.com/regex-python/): quick match of complex patterns||[Exercices](https://www.hackerrank.com/domains/regex)|

[Neetcode's Roadmap](https://neetcode.io/roadmap)

## Codeforces
[![Codeforces Rating of @arurangi](https://cfrating.baoshuo.dev/rating?username=arurangi&style=for-the-badge)](https://codeforces/profile/arurangi)
#### Topics per rating
|||||||
|-|-|:-:|:-|:-:|:-:|
||Title |Rating|Topics|Notes|Exercices|
|

  • - [ ]
|Newbie|0 - 1199|- Modular Arithmetic
- Basic knowledge of primes, multiples, divisors
- Euclidean algorithm
- Sieve of eatosthenes
- Binary modular eponentiation
- Combinatorics||Exercices|
|
  • - [ ]
|Pupil|1200 - 1399||||
|
  • - [ ]
|Specialist|1400 - 1599||||
|
  • - [ ]
|Expert|>= 1600||||

## Reminders in Python

#### Converting list to dictionnary counter
```python
from collections import Counter

array = [1, 2, 3, 4, 2, 2, 1, 4]
count = Counter(arr)
# Counter({2: 3, 1: 2, 4: 2, 3: 1})
```

#### Declaring 2D array filled with zeros
```python
mat = [[0] * m for _ in range(n)]
```
#### Sorting tuples by key
```python
data.sort(key=lambda x: x[0])
```
#### Walrus operator
```python
import time

def do_something() -> int:
sleep(1)
return 42

# slow
if do_something() == 42:
return do_something()

# much better
x = do_something()
if x == 42:
return x

# more concise, better? maybe
if (x := do_something()) == 42:
return x
```
[⇪ **Back up**](#dojo)