This is repository of data structures and algorithms written in JavaScript and Ruby. Some of the algorithms are from Cracking the Coding Interview by Gayle Laakmann McDowell .
Contributions are welcome! Please read the Contributing guidelines and the Code of Conduct on how to contribute. This project is Licensed under the MIT License.
To run Ruby specs, execute the rspec
command in the terminal
To run JavaScript specs, execute the rake jasmine
command in the terminal. Then open a web browser to
https://localhost:8888/
- Binary Tree (JS)(R)
- Doubly Linked List (R)
- Hash Table (JS)
- Queue (JS)
- Queue with Two Stacks (CtCI)(JS)
- Singly Linked List (R)
- Stack (JS)(R)
- Stack with Two Queues (CtCI)(JS)
- Tree (JS)
- Trie (JS)
- Array - Binary Search Tree From Array (R)
- Array - Contains Duplicate (JS)
- Array - Difference Between Arrays (R)
- Array - Find Single Number (R)
- Array - Highest Product of 3 (JS)
- Array - Longest Common Prefix (R)
- Array - Majority Element (JS)
- Array - Make Change (CtCI)(JS)(R)
- Array - Maxiumum Subsequence (CtCI)(DP)(R)
- Array - Merge Two Sorted Lists (JS)(R)
- Array - Min Change Sum (CtCI)(DP)(R)
- Array - Missing Number (CtCI)(R)
- Array - Product of All Ints Except @ Index (JS)
- Array - Quicksort (JS)
- Array - Remove Value (JS)
- Array - Rotate Array (R)
- Array - Rotate Matrix (CtCI 1.7)(R)(P)
- Array - Shuffle in Place (R)
- Array - Stock Picker (JS)
- Array - Subsets (JS)
- Array - Summary Ranges (R)
- Array - Transpose (JS)
- Array - Traverse Spiral Matrix (R)
- Array - Two Sum (R)
- Array - Zero Matrix (CtCI 1.8)(R)(P)
- Graph - Balanced Binary Tree (R)
- Graph - Binary Tree Inorder Traversal (R)
- Graph - Binary Tree Preorder Traversal (R)
- Graph - Binary Tree to Linked List (R)
- Graph - Breadth First Search (JS)(R)
- Graph - Danny Search (R)
- Graph - Depth First Search (JS)(R)
- Graph - Dijkstras (R)
- Graph - Invert Binary Tree (JS)(R)
- Graph - Is Same Tree (JS)
- Graph - Largest Internal Binary Search Tree (R)
- Graph - Lowest Common Ancestor in BST (CtCI)(R)
- Graph - Maximum Depth of Binary Tree (JS)(R)
- Graph - Minimum Depth of Binary Tree (JS)(R)
- Graph - Path Between Two Nodes (CtCI)(R)
- Graph - Root to Leaf Paths (R)
- Graph - Second Largest Value in Binary Tree (JS)
- Graph - Symmetric Binary Tree (JS)
- Graph - Topological Sort (R)
- Graph - Tree Breadth First Search (R)
- Graph - Tree Path Equals Sum (CtCI)(R)
- Graph - Valid Binary Tree (R)
- Linked List - Add Reverse Linked List Digits (CtCI)(R)
- Linked List - Delete Kth Node in Linked List (R)
- Linked List - Delete Node in Linked List (JS)
- Linked List - Delete Middle Node in Linked List (CtCI 2.3)(R)
- Linked List - Find Linked List Cycle (CtCI)(R)
- Linked LIst - Intersection of two lists (CtCI 2.7)(R)
- Linked List - Linked List Palindrome (CtCI)(R)
- Linked List - Loop Detection (CtCI 2.8)(R)
- Linked List - Palindrome (CtCI 2.6)(JS)(R)(R2)
- Linked List - Partition Linked List (CtCI)(R)
- Linked List - Return Kth to last node (CtCI 2.2)(R)
- Linked List - Remove Duplicates in Linked List (CtCI 2.1)(R)
- Linked List - Reverse Linked List (JS)
- Linked List - Sum Lists (CtCI 2.5)(R)
- Misc - Climbing Stairs (JS)
- Misc - Count Primes (R)
- Misc - Digital Root (JS)
- Misc - Fibonacci Number (JS)
- Misc - First Bad Version (R)
- Misc - Hamming Weight (JS)
- Misc - HiCal (JS)
- Misc - Pascal's Triangle (R)
- Misc - Power of 2 (JS)
- Misc - Rate Limiter (R)
- Misc - Seive of Erastenous (R)
- String - Add Binary (R)
- String - Anagrams (JS)(R)
- String - Balanced Parens (JS)
- String - String Compression (CtCI 1.6)(R)(P)
- String - Caeser Cipher (R)
- String - Encode URL (CtCI)(R)
- String - Is Substring (CtCI)(R)
- String - Isomorphic Strings (R)
- String - One Edit Away (CtCI)(R)(P)
- String - Permutation Palindrome (CtCI 1.4)(JS)(R)(P)
- String - Permutation Strings (CtCI 1.2)(R)(P)
- String - Remove Duplicates in Text (R)
- String - Reverse Characters and String (CtCI)(R)
- String - Roman Numeral -> Integer (JS)
- String - String Rotation (CtCI 1.9)(R)
- String - Substrings (JS)
- String - Unique Characters (CtCI 1.1)(R)(P)
- String - Valid Anagram (JS)
- (R) means Ruby
- (JS) means JavaScript
- (P) means Python
- (CtCI) means Cracking the Coding Interview
- (DP) means Dynamic Programming