Skip to content

rurangiza/dojo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to the Dojo

Data Structures & Algorithms

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
Dynamic Arrays: order is important, fast read, fast back insert C - Python Leetcode
Linked-List: order not important, sequence matters, fast front/mid insert C - Python Leetcode
Stack: frequent insert and remove at end = LIFO Python Leetcode
Queues: frequent insert at end and remove from front = FIFO Python Leetcode
Hash Tables: order not important, no duplicates, fast read/write/search Notes Leetcode
Sets: 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, Bubble Sort, Insertion Sort O(n^2) Notes Leetcode
Merge Sort, Quick Sort O(nlogn) Notes Leetcode
Counting Sort [2] O(n) for limited range! Notes Leetcode
Bucket Sort [2] Leetcode
Binary Search Python Leetcode
Techniques: common ways of approaching common problems Theory & Implementation Exercices
Two Pointers Leetcode
Prefix Sum Leetcode
Sliding Window Leetcode
Concepts Theory & Concepts Exercices
Recursion: function calling itself, required for trees, backtracking and dynamic programming Exercices
Bit Manipulation: fast operates without extra space required Exercices
Regular Expressions / 2: quick match of complex patterns Exercices

Neetcode's Roadmap

Codeforces

Codeforces Rating of @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

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

mat = [[0] * m for _ in range(n)]

Sorting tuples by key

data.sort(key=lambda x: x[0])

Walrus operator

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