When I get stuck on something, I like to solve puzzles and implement algorithms as a form of focused distraction. This is a collection of my implementations of various things that I wrote to pass the time. They are in C++ and Obj-C because I enjoy working on those languages. Maybe I'll add some Rust soon.
Binary Search Tree — Intruduction to Algorithms. Cormen, Leiserson, Rivest and Stein, MIT Press. (C++)
Red Black Tree — Intruduction to Algorithms. Cormen, Leiserson, Rivest and Stein, MIT Press. (C++)
Heapsort — Intruduction to Algorithms. Cormen, Leiserson, Rivest and Stein, MIT Press. (Obj-C)
Mergesort — Intruduction to Algorithms. Cormen, Leiserson, Rivest and Stein, MIT Press. (Obj-C)
Quicksort — Intruduction to Algorithms. Cormen, Leiserson, Rivest and Stein, MIT Press. (Obj-C)
Improved Mergesort (C++)
Heap's Algorithm for generating permutations (C++)
Fibonacci number generator (C++)
Balance Brackets (C)
Balanced Split (Obj-C)
Number of Visible Nodes (C)
Reverse Operations (Obj-C)
Reverse Operations C (C)
Leetcode has a funny subculture. If you look at the solutions, you will see very often things like "solution in 4 lines of C" or "solution in two lines of python" and so on. Very reminiscent of the "Obfuscated C Code" contests from back in the day. I get that this is fun to do (and I'm also envious as this is a skill that I don't have). My implementations are a little more verbose and sometimes inconsistent, as my style has evolved over the years.
I've been going through the problems marked "Hard" and solving them, my solutions are in a mix of Objective-C and C++ depending on what I was doing at the time. Recently I've started re-visiting my old solutions to see how they held up to the test of time and improving their implementations as I've become a better programmer.
Leetcode № 2 (Medium) — Add two Numbers(C++)
Leetcode № 4 (Hard) — Median of Two Sorted Arrays (C++)
Leetcode № 7 (Medium) — Reverse Integer (C)
Leetcode № 8 (Medium) — String to Integer (C++)
Leetcode № 23 (Hard) — Merge K Sorted Lists (Obj-C)
Leetcode № 25 (Hard) — Reverse Nodes in k-Group (C++)
Leetcode № 30 (Hard) — Substring with concatenation of all words (C++)
Leetcode № 41 (Hard) — First Missing Positive (C++).
Leetcode № 42 (Hard) — Trapping Rain Water (C++).
Leetcode № 51 (Hard) — N-Queens (C++11).
Leetcode № 52 (Hard) — N-Queens II (C++11).
Leetcode № 60 (Hard) — Permutation Sequence (C++11,C++17).
Leetcode № 68 (Hard) — Text Justification (C++11,C++17).
Leetcode № 76 (Hard) — Minimum Window Substring(C++11,C++17).
Leetcode № 80 (Medium) — Remove duplicates from Sorted Array II (C)
Leetcode № 84 (Hard) — Largest Rectangle in Histogram (C++11)
Leetcode № 85 (Hard) — Maximal Rectangle (C++)
Leetcode № 123 (Hard) — Best time to Buy and Sell Stock III (C++)
Leetcode № 135 (Hard) — Candy (C++)
Leetcode № 149 (Hard) — Max Points on a Line (C++)
Leetcode № 174 (Hard) — Dungeon Game (C++)
Leetcode № 188 (Hard) — Best time to Buy and Sell Stock IV(C++)
Leetcode № 218 (Hard) — The Skyline Problem (Obj-C)
Leetcode № 233 (Hard) — Number of Digit One (C++/Hard)
Leetcode № 239 (Hard) Sliding Window Maximum(C++/Hard)
Leetcode № 605 (Easy) — Can Place Flowers(C++)
Leetcode № 695 (Medium) — Max Area of Island (Obj-C)
Leetcode № 1923 (Hard) — Longest Common Subpath (Obj-C)
Leetcode № 2104 (Medium) — Sum of Subarray Ranges (Obj-C)
Leetcode № 2106 (Hard) — Maximum Fruits Harvested After at Most K Steps (Obj-C)