An open API service indexing awesome lists of open source software.

https://github.com/dbz/algorithms

Data Structures & Algorithms. Includes solutions for Cracking the Coding Interview 6th Edition
https://github.com/dbz/algorithms

algorithm algorithm-challenges algorithms computer-science cracking-the-coding-interview data-structures datastructures graph heap javascript python queue ruby stack stacks sum tree trees trie tries

Last synced: 9 days ago
JSON representation

Data Structures & Algorithms. Includes solutions for Cracking the Coding Interview 6th Edition

Awesome Lists containing this project

README

        

Data Structures & Algorithms Repository
==========

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](http://www.amazon.com/gp/product/0984782850/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0984782850&linkCode=as2&tag=dbz03-20&linkId=LVVF6HDIDG3XQICI)
.

# Contributing

Contributions are welcome! Please read the [ Contributing guidelines](/CONTRIBUTING.md) and the [Code of Conduct](/CODE_OF_CONDUCT.md) on how to contribute.
This project is Licensed under the [MIT License](/LICENSE.md).

## Ruby Instructions:

To run Ruby specs, execute the `rspec` command in the terminal

## JavaScript Instructions:

To run JavaScript specs, execute the `rake jasmine` command in the terminal. Then open a web browser to
http://localhost:8888/

# Algorithms & Data Structures

```
Key
- (R) means Ruby
- (JS) means JavaScript
- (P) means Python
- (CtCI) means Cracking the Coding Interview
- (DP) means Dynamic Programming
```

* Array - Binary Search Tree From Array ([R](/algorithms/binary_search_tree_from_array.rb))
* Array - Contains Duplicate ([JS](/algorithms/contains-duplicate.js))
* Array - Difference Between Arrays ([R](/algorithms/difference_between_arrays.rb))
* Array - Find Single Number ([R](/algorithms/find_single_number.rb))
* Array - Highest Product of 3 ([JS](/algorithms/highest-product-of-three.js))
* Array - Longest Common Prefix ([R](/algorithms/longest_common_prefix.rb))
* Array - Majority Element ([JS](/algorithms/majority-element.js))
* Array - Make Change (CtCI)([JS](/algorithms/make-change.js))([R](/algorithms/make_change.rb))
* Array - Maxiumum Subsequence (CtCI)(DP)([R](/algorithms/max_subsequence.rb))
* Array - Merge Two Sorted Lists ([JS](/algorithms/merge-two-sorted-lists.js))([R](/algorithms/merge_sorted_arrays.rb))
* Array - Min Change Sum (CtCI)(DP)([R](/algorithms/min_change_sum.rb))
* Array - Missing Number (CtCI)([R](/algorithms/missing_number.rb))
* Array - Product of All Ints Except @ Index ([JS](/algorithms/product-of-ints.js))
* Array - Quicksort ([JS](/algorithms/quicksort.js))
* Array - Remove Value ([JS](/algorithms/remove-value.js))
* Array - Rotate Array ([R](/algorithms/rotate_array.rb))
* Array - Rotate Matrix (CtCI 1.7)([R](/algorithms/rotate_matrix.rb))([P](/algorithms/rotate_matrix.py))
* Array - Shuffle in Place ([R](/algorithms/shuffle_array_in_place.rb))
* Array - Stock Picker ([JS](/algorithms/stock-picker.js))
* Array - Subsets ([JS](/algorithms/subsets.js))
* Array - Summary Ranges ([R](/algorithms/summary_ranges.rb))
* Array - Transpose ([JS](/algorithms/transpose.js))
* Array - Traverse Spiral Matrix ([R](/algorithms/traverse_spiral_matrix.rb))
* Array - Two Sum ([R](/algorithms/two_sum.rb))
* Array - Zero Matrix (CtCI 1.8)([R](/algorithms/zero_matrix.rb))([P](/algorithms/zero_matrix.py))
* Data Structure - Binary Tree ([JS](/data-structures/binary-tree.js))([R](/data-structures/binary_tree.rb))
* Data Structure - Doubly Linked List ([R](/data-structures/doubly_linked_list.rb))
* Data Structure - Hash Table ([JS](/data-structures/hash-table.js))
* Data Structure - Min Heap ([R](/data-structures/min_heap.rb))
* Data Structure - Queue ([JS](/data-structures/queue.js))
* Data Structure - Queue with Two Stacks (CtCI)([JS](/data-structures/queue-with-two-stacks.js))
* Data Structure - Singly Linked List ([R](/data-structures/singly_linked_list.rb))
* Data Structure - Stack ([JS](/data-structures/stack.js))([R](/data-structures/linked_stack.rb))
* Data Structure - Stack with Two Queues (CtCI)([JS](/data-structures/stack-with-two-queues.js))
* Data Structure - Tree ([JS](/data-structures/tree.js))
* Data Structure - Trie ([JS](/data-structures/trie.js))
* Graph - Balanced Binary Tree ([R](/algorithms/balanced_binary_tree.rb))
* Graph - Binary Tree Inorder Traversal ([R](/algorithms/binary_tree_inorder_traversal.rb))
* Graph - Binary Tree Preorder Traversal ([R](/algorithms/binary_tree_preorder_traversal.rb))
* Graph - Binary Tree to Linked List ([R](/algorithms/binary_tree_to_linked_list.rb))
* Graph - Breadth First Search ([JS](/algorithms/JavaScript/breadth-first-search.js))([R](/algorithms/graph_breadth_first_search.rb))
* Graph - Danny Search ([R](/algorithms/danny_search.rb))
* Graph - Depth First Search ([JS](/algorithms/depth-first-search.js))([R](/algorithms/graph_depth_first_search.rb))
* Graph - Dijkstras ([R](/algorithms/dijkstras.rb))
* Graph - Invert Binary Tree ([JS](/algorithms/invert-binary-tree.js))([R](/algorithms/invert_binary_tree.rb))
* Graph - Is Same Tree ([JS](/algorithms/is-same-tree.js))
* Graph - Largest Internal Binary Search Tree ([R](/algorithms/largest_internal_binary_search_tree.rb))
* Graph - Lowest Common Ancestor in BST (CtCI)([R](/algorithms/lowest_common_ancestor.rb))
* Graph - Maximum Depth of Binary Tree ([JS](/algorithms/maximum-depth-of-binary-tree.js))([R](/algorithms/maximum_depth_of_binary_tree.rb))
* Graph - Minimum Depth of Binary Tree ([JS](/algorithms/minimum-depth-of-binary-tree.js))([R](/algorithms/minimum_depth_of_binary_tree.rb))
* Graph - Path Between Two Nodes (CtCI)([R](/algorithms/path_between_two_nodes.rb))
* Graph - Root to Leaf Paths ([R](/algorithms/root_to_leaf_paths.rb))
* Graph - Second Largest Value in Binary Tree ([JS](/algorithms/second-largest-binary-tree.js))
* Graph - Symmetric Binary Tree ([JS](/algorithms/symmetric-binary-tree.js))
* Graph - Topological Sort ([R](/algorithms/topological_sort.rb))
* Graph - Tree Breadth First Search ([R](/algorithms/tree_breadth_first_search.rb))
* Graph - Tree Path Equals Sum (CtCI)([R](/algorithms/tree_path_equals_sum.rb))
* Graph - Valid Binary Tree ([R](/algorithms/valid_binary_tree.rb))
* Linked List - Add Reverse Linked List Digits (CtCI)([R](/algorithms/add_reversed_linked_list_digits.rb))
* Linked List - Animal Shelter (CtCI 3.6)([R](/algorithms/animal_shelter.rb))
* Linked List - Delete Kth Node in Linked List ([R](/algorithms/delete_kth_node.rb))
* Linked List - Delete Node in Linked List ([JS](/algorithms/delete-node-in-linked-list.js))
* Linked List - Delete Middle Node in Linked List (CtCI 2.3)([R](/algorithms/delete_middle_node.rb))
* Linked List - Find Linked List Cycle (CtCI)([R](/algorithms/find_linked_list_cycle.rb))
* Linked LIst - Intersection of two lists (CtCI 2.7)([R](/algorithms/intersection.rb))
* Linked List - Linked List Palindrome (CtCI)([R](/algorithms/linked_list_palindrome.rb))
* Linked List - Loop Detection (CtCI 2.8)([R](/algorithms/loop_detection.rb))
* Linked List - Palindrome (CtCI 2.6)([JS](/algorithms/palindrome.js))([R](/algorithms/palindrome_linked_list.rb))([R2](/algorithms/palindrome.rb))
* Linked List - Partition Linked List (CtCI)([R](/algorithms/partition_linked_list.rb))
* Linked List - Return Kth to last node (CtCI 2.2)([R](/algorithms/return_kth_to_last_element.rb))
* Linked List - Remove Duplicates in Linked List (CtCI 2.1)([R](/algorithms/remove_duplicates_in_linked_list.rb))
* Linked List - Reverse Linked List ([JS](/algorithms/reverse-linked-list.js))
* Linked List - Sum Lists (CtCI 2.5)([R](/algorithms/sum_lists.rb))
* Misc - Climbing Stairs ([JS](/algorithms/climbing-stairs.js))
* Misc - Count Primes ([R](/algorithms/count_primes.rb))
* Misc - Digital Root ([JS](/algorithms/digital-root.js))
* Misc - Fibonacci Number ([JS](/algorithms/fibonacci-number.js))
* Misc - First Bad Version ([R](/algorithms/first_bad_version.rb))
* Misc - Hamming Weight ([JS](/algorithms/hamming-weight.js))
* Misc - HiCal ([JS](/algorithms/hical.js))
* Misc - Pascal's Triangle ([R](/algorithms/pascals_triangle.rb))
* Misc - Power of 2 ([JS](/algorithms/power-of-two.js))
* Misc - Rate Limiter ([R](/algorithms/rate_limiter.rb))
* Misc - Seive of Erastenous ([R](/algorithms/seive_of_erastenous.rb))
* Stack - Sort Stack (CtCI 3.5)([R](/algorithms/sort_stack.rb))
* String - Add Binary ([R](/algorithms/add_binary.rb))
* String - Anagrams ([JS](/algorithms/JavaScript/anagrams.js))([R](/algorithms/anagrams.rb))
* String - Balanced Parens ([JS](/algorithms/balanced-parens.js))
* String - String Compression (CtCI 1.6)([R](/algorithms/string_compression.rb))([P](/algorithms/string_compression.py))
* String - Caeser Cipher ([R](/algorithms/caesar_cipher.rb))
* String - Encode URL (CtCI)([R](/algorithms/encode_url.rb))
* String - Is Substring (CtCI)([R](/algorithms/string_is_substring.rb))
* String - Isomorphic Strings ([R](/algorithms/isomorphic_strings.rb))
* String - One Edit Away (CtCI)([R](/algorithms/one_edit_away.rb))([P](/algorithms/one_away.py))
* String - Permutation Palindrome (CtCI 1.4)([JS](/algorithms/permutation-palindrome.js))([R](/algorithms/permutation_palindrome.rb))([P](/algorithms/palindrome_permutation.py))
* String - Permutation Strings (CtCI 1.2)([R](/algorithms/permutations_strings.rb))([P](/algorithms/check_permutation.py))
* String - Remove Duplicates in Text ([R](/algorithms/remove_duplicates.rb))
* String - Reverse Characters and String (CtCI)([R](/algorithms/reverse_characters_and_string.rb))
* String - Roman Numeral -> Integer ([JS](/algorithms/roman-numeral-to-integer.js))
* String - String Rotation (CtCI 1.9)([R](/algorithms/string_rotation.rb))
* String - Substrings ([JS](/algorithms/substrings.js))
* String - Unique Characters (CtCI 1.1)([R](/algorithms/is_unique.rb))([P](/algorithms/is_unique.py))
* String - Valid Anagram ([JS](/algorithms/valid-anagram.js))