|
1 |
| -# coding_exercises |
| 1 | +This repository contains my implementation of useful data structures, algorithms, |
| 2 | +games, as well as my solutions to programming puzzles. |
| 3 | + |
| 4 | +Each item is marked with a difficulty level. |
| 5 | +1 - easy |
| 6 | +2 - medium |
| 7 | +3 - hard |
| 8 | + |
| 9 | +If a file name starts with 'lc', it's a problem from leetcode.com |
| 10 | + |
| 11 | +Written in python3. Thanks Danijar Hafner () |
| 12 | + |
| 13 | +Data structures |
| 14 | +--------------- |
| 15 | + |
| 16 | +### Linked lists |
| 17 | + |
| 18 | +- [x] List class (linked_list.py) - 1 |
| 19 | +- [ ] Remove duplicates (linked_list_algos.py) |
| 20 | +- [ ] Find nth last element (linked_list_algos.py) |
| 21 | +- [ ] Remove node given only its object (linked_list_algos.py) |
| 22 | +- [ ] Sum linked lists with one digit per node (linked_list_algos.py) |
| 23 | +- [ ] Find beginning of circle (linked_list_algos.py) |
| 24 | + |
| 25 | +### Trees |
| 26 | + |
| 27 | +- [x] Binary heap class (binary_heap.py) - 2 |
| 28 | +- [ ] Binary tree class (binary_tree.py) - 1 |
| 29 | +- [x] Binary search tree class that allows duplicate values (binary_search_tree.py) - 2 |
| 30 | + BST class inherits binary tree class |
| 31 | +- [ ] Red black tree class (red_black_tree.py) |
| 32 | +- [ ] B+ tree class (b_tree.py) - 3 |
| 33 | +- [x] Trie class that allows word removal (trie.py) - 2 |
| 34 | +- [x] Check if a binary tree is a binary search tree (binary_tree_algos.py) - 2 |
| 35 | +- [ ] Check if a binary tree is balanced (binary_tree_algos.py) |
| 36 | +- [ ] Find first common ancestor of two nodes in a binary tree (binary_tree_algos.py) |
| 37 | +- [ ] Get all nodes of depth n in a binary tree (binary_tree_algos.py) |
| 38 | +- [ ] Given two large trees, check if the first is a subtree of the second (binary_tree_algos.py) |
| 39 | +- [ ] Find all sub paths in a binary tree that sum up to x (binary_tree_algos.py) |
| 40 | +- [ ] Create a balanced binary search tree from a sorted array (bst_algos.py) |
| 41 | + |
| 42 | +### Graphs |
| 43 | + |
| 44 | +- [ ] Undirected graph class |
| 45 | +- [ ] Directed graph class |
| 46 | +- [ ] Breadth first search (search.py) |
| 47 | +- [ ] Depth first search (search.py) |
| 48 | +- [ ] A-star (search.py) |
| 49 | + |
| 50 | +### Stacks and queues |
| 51 | + |
| 52 | +- [ ] Queue class (queue.py) |
| 53 | +- [x] Heap priority queue (priority_queue.py) - 1 |
| 54 | +- [ ] Stack class (stack.py) |
| 55 | +- [ ] Stack that finds min in O(1) (min_stack.py) |
| 56 | +- [ ] Solve Hanoi towers using stacks (stack_algos.py) |
| 57 | +- [ ] Sort stack using only push, pop, peek and empty (stack_algos.py) |
| 58 | +- [ ] Build a queue using two stacks (stack_algos.py) |
| 59 | + |
| 60 | +Algorithms |
| 61 | +---------- |
| 62 | + |
| 63 | +### Sorting |
| 64 | +- [x] Insertion sort (sort.py) - 1 |
| 65 | +- [x] Selection sort (sort.py) - 1 |
| 66 | +- [x] Merge sort (sort.py) - 2 |
| 67 | +- [x] Heap sort (sort.py) - 2 |
| 68 | +- [x] Quick sort (sort.py) - 2 |
| 69 | +- [x] Counting sort (sort.py) - 2 |
| 70 | +- [x] Radix sort (sort.py) - 2 |
| 71 | +- [x] Bucket sort (sort.py) - 2 |
| 72 | + |
| 73 | +### Dynamic Programming |
| 74 | +- [ ] Computing a Fibonacci sequence |
| 75 | +- [ ] Find the longest common subsequence between two strings |
| 76 | + |
| 77 | +### Recursion |
| 78 | + |
| 79 | +- [ ] Find all permutations of a string |
| 80 | +- [ ] Find all subsets of a set |
| 81 | +- [ ] Find all proper combinations of n parentheses |
| 82 | +- [ ] Bucket fill |
| 83 | +- [ ] Check if it's possible to make a change with a set of coins |
| 84 | +- [ ] Check if it's possible to weight two objects with a set of weights |
| 85 | +- [ ] Eight queen |
| 86 | + |
| 87 | +Programming Puzzles |
| 88 | +------------------- |
| 89 | + |
| 90 | +### String Manipulation |
| 91 | +- [x] Check if two strings are anagrams in O(n + m) time (anagrams.py) - 1 |
| 92 | +- [x] Find the longest palindromic substring in O(n^2) time (lc_longest_palindrome.py) - 2 |
| 93 | +- [x] Check if a string has balanced delimiters in O(n) time (delim_balanced.py) - 2 |
| 94 | +- [x] Reverse words while maintaining spaces and tabs in O(n) time (reverse_words.py) - 2 |
| 95 | +- [x] Longest substring without repeating characters in O(n) time (lc_longest_nonrepeat_substring.py) - 2 |
| 96 | +- [x] Longest contiguous substring of 2 distinct characters in O(n) time (substring_two_chars.py) - 2 |
| 97 | +- [ ] Remove duplicate chars in a string |
| 98 | +- [ ] Encode and decode Caesar cipher (caesar.py) |
| 99 | +- [ ] Check if a string is a rotation of another |
| 100 | + |
| 101 | +### Mathematical |
| 102 | +- [x] Reverse integers (lc_reverse_int.py) - 1 |
| 103 | +- [x] Sieve of Eratosthenes (sieve_prime.py) - 1 |
| 104 | +- [x] Two sum in O(n) time (lc_two_sum.py) - 1 |
| 105 | + Given an array of integers, return indices of the two numbers |
| 106 | + such that they add up to a specific target. |
| 107 | +- [x] Year with maximum population (year_max_pop.py) - 1 |
| 108 | + Given a list of people with their years of birth and death, |
| 109 | + find the year with max population |
| 110 | +- [x] FizzBuzz (fizzbuzz.py) - 1 |
| 111 | +- [x] ZigZag conversion (lc_zigzag_convert.py) - 2 |
| 112 | +- [x] Find sum of all subarrays of an array (subarray_sum.py) - 2 |
| 113 | +- [x] Add two numbers, each represented by a reverse linked list (lc_add_number_reverse.py) - 2 |
| 114 | +- [x] Find the median of two sorted arrays in O(log(m+n)) time (lc_median_arrays.py) - 3 |
| 115 | +- [ ] Find nth smallest number that can be created using a list of prime factors |
| 116 | +- [ ] Count occurences of given digit in all numbers up to n |
| 117 | +- [ ] Rotate N x N matrix in place |
0 commit comments