Skip to content

aeu/legible-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

legible-algorithms

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.

Data Structures

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++)

Sorting & Searching

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++)

Permutations

Heap's Algorithm for generating permutations (C++)

Random Snippets

Fibonacci number generator (C++)
Drop in, int holding, memory safe linked list (C++)

Puzzles & Problems

Facebook

Balance Brackets (C)
Balanced Split (Obj-C)
Number of Visible Nodes (C)
Reverse Operations (Obj-C)
Reverse Operations C (C)

Leetcode

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, which reminds me 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 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 learned more. Some of my earlier mistakes that I've found are pretty stellar, this is something that I need to do more if I want to become a better programmer.

Hard

Leetcode № 4 (Hard) — Median of Two Sorted Arrays (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 № 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 № 1923 (Hard) — Longest Common Subpath (Obj-C)
Leetcode № 2106 (Hard) — Maximum Fruits Harvested After at Most K Steps (Obj-C)

Medium

Leetcode № 2 (Medium) — Add two Numbers(C++)
Leetcode № 7 (Medium) — Reverse Integer (C)
Leetcode № 8 (Medium) — String to Integer (C++)
Leetcode № 11 (Medium) — Container with Most Water (C++)
Leetcode № 80 (Medium) — Remove duplicates from Sorted Array II (C)
Leetcode № 151 (Medium) — Reverse Words in a String (C++)
Leetcode № 238 (Medium) — Product of Array except Self (C++)
Leetcode № 328 (Medium) — Odd Even Linked List (C++)
Leetcode № 394 (Medium) — Decode String (C++)
Leetcode № 695 (Medium) — Max Area of Island (Obj-C)
Leetcode № 735 (Medium) — Asteroid Collision (C++)
Leetcode № 1004 (Medium) — Max Consecutive Ones III (C++)
Leetcode № 1456 (Medium) — Maximum Number of Vowels in a Substring of Given Length (C++)
Leetcode № 1493 (Medium) — Longest Subarray of 1's after Deleting One Element (C++)
Leetcode № 1679 (Medium) — Max Numbef of K-Sum Pairs(C++)
Leetcode № 2095 (Medium) — Delete the Middle Node of a Linked List (C++)
Leetcode № 2104 (Medium) — Sum of Subarray Ranges (Obj-C)
Leetcode № 2130 (Medium) — Maximum Twin Sum of a Linked List (C++)
Leetcode № 2352 (Medium) — Equal Row and Column Pairs (C++)

Easy

Leetcode № 206 (Easy) — Reverse Linked List (C++)
Leetcode № 283 (Easy) — Move Zeroes (C++)
Leetcode № 345 (Easy) — Reverse Vowels of a String (C++)
Leetcode № 605 (Easy) — Can Place Flowers(C++)
Leetcode № 724 (Easy) — Find Pivot Index (C++)
Leetcode № 1071 (Easy) — Greatest Common Divisor of Strings (C++)
Leetcode № 1207 (Easy) — Unique Number of Occurrences (C++)
Leetcode № 1732 (Easy) — Find The Highest Altitude(C++)
Leetcode № 2215 (Easy) — Find the Difference of Two Arrays (C++)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published