Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/marcosfede/algorithms

Solved algorithms and data structures problems in many languages
https://github.com/marcosfede/algorithms

algorithm bfs competitive-programming data-structures go golang graph hacktoberfest heap interview interview-practice javascript language python ruby

Last synced: about 6 hours ago
JSON representation

Solved algorithms and data structures problems in many languages

Awesome Lists containing this project

README

        

# Data Structure and Algorithmic Problems solved in many languages

[![Join the chat at https://gitter.im/marcosfede/algorithms](https://badges.gitter.im/marcosfede/algorithms.svg)](https://gitter.im/marcosfede/algorithms?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This repository is inspired by [keon's](https://github.com/keon/algorithms) solved problems in Python 3.
I wanted to compare solutions across different languages and learn them in the process.
Solutions may be my own, or taken from the internet.

Click on the icons to search by language


rust
go
python
javascript
haskell
julia
elixir
scala
ruby
cpp

## List of problems

### Events

#### Google Code Jam
- [x] [googlecodejam](googlecodejam)
- [x] [2017](googlecodejam/2017)
- [x] [Oversized Pancake Flipper](googlecodejam/2017/Oversized%20Pancake%20Flipper)
- [x] [Tidy Numbers](googlecodejam/2017/Tidy%20Numbers)
- [x] [Fashion Show](googlecodejam/2017/Fashion%20Show)
- [x] [2018](googlecodejam/2018)
- [x] [Bathroom Stalls](googlecodejam/2018/Bathroom%20Stalls)
- [x] [Number Guessing](googlecodejam/2018/Number%20Guessing)
- [x] [Senate Evacuation](googlecodejam/2018/Senate%20Evacuation)
- [x] [Cruise Control](googlecodejam/2018/Cruise%20Control)
- [x] [Cube UFO](googlecodejam/2018/Cube%20UFO)
- [x] [Go Gopher](googlecodejam/2018/Go%20Gopher)
- [x] [Saving The Universe Again](googlecodejam/2018/Saving%20The%20Universe%20Again)
- [x] [Trouble Sort](googlecodejam/2018/Trouble%20Sort)
- [x] [Waffle Choppers](googlecodejam/2018/Waffle%20Choppers)
- [x] [Lollipop Shop](googlecodejam/2018/Lollipop%20Shop)
- [x] [Rounding Error](googlecodejam/2018/Cryptopangrams)
- [x] [2019](googlecodejam/2019)
- [x] [Cryptopangrams](googlecodejam/2019/Rounding%20Error)
- [x] [Dat Bae](googlecodejam/2019/Dat%20Bae)
- [x] [Foregone Solution](googlecodejam/2019/Foregone%20Solution)
- [x] [You Can Go Your Own Way](googlecodejam/2019/You%20Can%20Go%20Your%20Own%20Way)

#### Advent of Code

- [x] [adventofcode](adventofcode)
- [ ] [2018](adventofcode/2018)
- [x] [1](adventofcode/2018/1)
- [x] [2](adventofcode/2018/2)
- [x] [3](adventofcode/2018/3)
- [x] [4](adventofcode/2018/4)
- [x] [5](adventofcode/2018/5)
- [x] [6](adventofcode/2018/6)
- [x] [7](adventofcode/2018/7)
- [x] [8](adventofcode/2018/8)
- [x] [9](adventofcode/2018/9)
- [x] [10](adventofcode/2018/10)
- [x] [11](adventofcode/2018/11)
- [x] [12](adventofcode/2018/12)
- [x] [13](adventofcode/2018/13)
- [x] [14](adventofcode/2018/14)
- [x] [15](adventofcode/2018/15)
- [x] [16](adventofcode/2018/16)
- [x] [17](adventofcode/2018/17)
- [x] [18](adventofcode/2018/18)
- [x] [19](adventofcode/2018/19)
- [x] [20](adventofcode/2018/20)
- [x] [21](adventofcode/2018/21)
- [x] [22](adventofcode/2018/22)
- [x] [23](adventofcode/2018/23)
- [ ] [24](adventofcode/2018/24)
- [ ] [25](adventofcode/2018/25)

- [x] [2019](adventofcode/2019)
- [x] [d1](adventofcode/2019/d1)
- [x] [d2](adventofcode/2019/d2)
- [x] [d3](adventofcode/2019/d3)
- [x] [d4](adventofcode/2019/d4)
- [x] [d5](adventofcode/2019/d5)
- [x] [d6](adventofcode/2019/d6)
- [x] [d7](adventofcode/2019/d7)
- [x] [d8](adventofcode/2019/d8)

### Data Structures
- [x] [array](array)
- [x] [circular_counter](array/circular_counter)
- [x] [flatten](array/flatten)
- [x] [garage](array/garage)
- [x] [golf_bot](array/golf_bot)
- [x] [longest_non_repeat](array/longest_non_repeat)
- [x] [merge_intervals](array/merge_intervals)
- [x] [missing_ranges](array/missing_ranges)
- [x] [plus_one](array/plus_one)
- [x] [rotate_array](array/rotate_array)
- [x] [summary_ranges](array/summary_ranges)
- [x] [three_sum](array/three_sum)
- [x] [two_sum](array/two_sum)
- [ ] [backtrack](backtrack)
- [x] [anagram](backtrack/anagram)
- [x] [array_sum_combinations](backtrack/array_sum_combination)
- [x] [combination_sum](backtrack/combination_sum)
- [x] [expression_add_operators](backtrack/expression_add_operators.py)
- [x] [factor_combinations](backtrack/factor_combinations/factor_combinations.py)
- [ ] [generate_abbreviations](backtrack/generate_abbreviations.py)
- [ ] [generate_parenthesis](backtrack/generate_parenthesis.py)
- [ ] [letter_combination](backtrack/letter_combination.py)
- [ ] [palindrome_partitioning](backtrack/palindrome_partitioning.py)
- [ ] [pattern_match](backtrack/pattern_match.py)
- [ ] [permute](backtrack/permute.py)
- [ ] [permute_unique](backtrack/permute_unique.py)
- [ ] [subsets](backtrack/subsets.py)
- [ ] [subsets_unique](backtrack/subsets_unique.py)
- [ ] [bfs](bfs)
- [x] [puzzle_game](bfs/puzzle_game)
- [ ] [shortest_distance_from_all_buildings](bfs/shortest_distance_from_all_buildings.py)
- [ ] [word_ladder](bfs/word_ladder.py)
- [ ] [bit](bit)
- [ ] [bytes_int_conversion](bit/bytes_int_conversion.py)
- [ ] [count_ones](bit/count_ones.py)
- [ ] [find_missing_number](bit/find_missing_number.py)
- [ ] [power_of_two](bit/power_of_two.py)
- [ ] [reverse_bits](bit/reverse_bits.py)
- [ ] [single_number2](bit/single_number2.py)
- [ ] [single_number](bit/single_number.py)
- [ ] [subsets](bit/subsets.py)
- [ ] [add_without_operator](bit/add_without_operator.py)
- [ ] [calculator](calculator)
- [ ] [math_parser](calculator/math_parser.py)
- [ ] [dfs](dfs)
- [ ] [all_factors](dfs/all_factors.py)
- [x] [count_islands](dfs/count_islands.py)
- [ ] [pacific_atlantic](dfs/pacific_atlantic.py)
- [ ] [sudoku_solver](dfs/sudoku_solver.py)
- [ ] [walls_and_gates](dfs/walls_and_gates.py)
- [ ] [dp](dp)
- [ ] [buy_sell_stock](dp/buy_sell_stock.py)
- [ ] [climbing_stairs](dp/climbing_stairs.py)
- [ ] [coin_change](dp/coin_change.py)
- [ ] [combination_sum](dp/combination_sum.py)
- [ ] [egg_drop](dp/egg_drop.py)
- [ ] [house_robber](dp/house_robber.py)
- [ ] [job_scheduling](dp/job_scheduling.py)
- [ ] [knapsack](dp/knapsack.py)
- [ ] [longest_increasing](dp/longest_increasing.py)
- [ ] [matrix_chain_order](dp/matrix_chain_order.py)
- [ ] [max_product_subarray](dp/max_product_subarray.py)
- [ ] [max_subarray](dp/max_subarray.py)
- [ ] [min_cost_path](dp/min_cost_path.py)
- [ ] [num_decodings](dp/num_decodings.py)
- [ ] [regex_matching](dp/regex_matching.py)
- [ ] [rod_cut](dp/rod_cut.py)
- [ ] [word_break](dp/word_break.py)
- [ ] [graph](graph)
- [ ] [strongly_connected](graph/checkDiGraphStronglyConnected.py)
- [ ] [clone_graph](graph/clone_graph.py)
- [ ] [cycle_detection](graph/cycle_detection.py)
- [ ] [find_all_cliques](graph/find_all_cliques.py)
- [ ] [find_path](graph/find_path.py)
- [ ] [graph](graph/graph.py)
- [ ] [markov_chain](graph/markov_chain.py)
- [ ] [minimum_spanning_tree](graph/minimum_spanning_tree.py)
- [ ] [satisfiability](graph/satisfiability.py)
- [ ] [tarjan](graph/tarjan.py)
- [ ] [traversal](graph/traversal.py)
- [ ] [heap](heap)
- [ ] [merge_sorted_k_lists](heap/merge_sorted_k_lists.py)
- [ ] [skyline](heap/skyline.py)
- [ ] [sliding_window_max](heap/sliding_window_max.py)
- [ ] [linkedlist](linkedlist)
- [ ] [add_two_numbers](linkedlist/add_two_numbers.py)
- [ ] [copy_random_pointer](linkedlist/copy_random_pointer.py)
- [ ] [delete_node](linkedlist/delete_node.py)
- [ ] [first_cyclic_node](linkedlist/first_cyclic_node.py)
- [x] [is_cyclic](linkedlist/is_cyclic.py)
- [ ] [is_palindrome](linkedlist/is_palindrome.py)
- [ ] [kth_to_last](linkedlist/kth_to_last.py)
- [ ] [linkedlist](linkedlist/linkedlist.py)
- [ ] [remove_duplicates](linkedlist/remove_duplicates.py)
- [ ] [reverse](linkedlist/reverse.py)
- [ ] [rotate_list](linkedlist/rotate_list.py)
- [ ] [swap_in_pairs](linkedlist/swap_in_pairs.py)
- [ ] [map](map)
- [ ] [hashtable](map/hashtable.py)
- [ ] [longest_common_subsequence](map/longest_common_subsequence.py)
- [ ] [randomized_set](map/randomized_set.py)
- [ ] [valid_sudoku](map/valid_sudoku.py)
- [ ] [maths](maths)
- [ ] [base_conversion](maths/base_conversion.py)
- [ ] [extended_gcd](maths/extended_gcd.py)
- [ ] [gcd/lcm](maths/gcd.py)
- [ ] [generate_strobogrammtic](maths/generate_strobogrammtic.py)
- [ ] [is_strobogrammatic](maths/is_strobogrammatic.py)
- [ ] [next_perfect_square](maths/next_perfect_square.py)
- [ ] [nth_digit](maths/nth_digit.py)
- [ ] [prime_test](maths/prime_test.py)
- [ ] [primes_sieve_of_eratosthenes](maths/primes_sieve_of_eratosthenes.py)
- [ ] [pythagoras](maths/pythagoras.py)
- [ ] [rabin_miller](maths/rabin_miller.py)
- [ ] [rsa](maths/rsa.py)
- [ ] [sqrt_precision_factor](maths/sqrt_precision_factor.py)
- [ ] [matrix](matrix)
- [ ] [bomb_enemy](matrix/bomb_enemy.py)
- [ ] [copy_transform](matrix/copy_transform.py)
- [ ] [count_paths](matrix/count_paths.py)
- [ ] [matrix_rotation.txt](matrix/matrix_rotation.txt)
- [ ] [rotate_image](matrix/rotate_image.py)
- [ ] [search_in_sorted_matrix](matrix/search_in_sorted_matrix.py)
- [ ] [sparse_dot_vector](matrix/sparse_dot_vector.py)
- [ ] [sparse_mul](matrix/sparse_mul.py)
- [ ] [spiral_traversal](matrix/spiral_traversal.py)
- [ ] [queues](queues)
- [ ] [max_sliding_window](queues/max_sliding_window.py)
- [ ] [moving_average](queues/moving_average.py)
- [ ] [queue](queues/queue.py)
- [ ] [reconstruct_queue](queues/reconstruct_queue.py)
- [ ] [zigzagiterator](queues/zigzagiterator.py)
- [ ] [search](search)
- [ ] [binary_search](search/binary_search.py)
- [ ] [first_occurance](search/first_occurance.py)
- [ ] [last_occurance](search/last_occurance.py)
- [ ] [set](set)
- [ ] [randomized_set](set/randomized_set.py)
- [ ] [set_covering](set/set_covering.py)
- [ ] [sort](sort)
- [ ] [bubble_sort](sort/bubble_sort.py)
- [ ] [comb_sort](sort/comb_sort.py)
- [ ] [counting_sort](sort/counting_sort.py)
- [ ] [heap_sort](sort/heap_sort.py)
- [ ] [insertion_sort](sort/insertion_sort.py)
- [ ] [meeting_rooms](sort/meeting_rooms.py)
- [ ] [merge_sort](sort/merge_sort.py)
- [ ] [quick_sort](sort/quick_sort.py)
- [ ] [selection_sort](sort/selection_sort.py)
- [ ] [sort_colors](sort/sort_colors.py)
- [ ] [topsort](sort/topsort.py)
- [ ] [wiggle_sort](sort/wiggle_sort.py)
- [ ] [stack](stack)
- [ ] [longest_abs_path](stack/longest_abs_path.py)
- [ ] [simplify_path](stack/simplify_path.py)
- [ ] [stack](stack/stack.py)
- [ ] [valid_parenthesis](stack/valid_parenthesis.py)
- [ ] [strings](strings)
- [x] [molecules_to_atoms](strings/molecules_to_atoms)
- [ ] [add_binary](strings/add_binary.py)
- [ ] [breaking_bad](strings/breaking_bad.py)
- [ ] [decode_string](strings/decode_string.py)
- [ ] [encode_decode](strings/encode_decode.py)
- [ ] [group_anagrams](strings/group_anagrams.py)
- [ ] [int_to_roman](strings/int_to_roman.py)
- [ ] [is_palindrome](strings/is_palindrome.py)
- [ ] [license_number](strings/license_number.py)
- [ ] [make_sentence](strings/make_sentence.py)
- [ ] [multiply_strings](strings/multiply_strings.py)
- [ ] [one_edit_distance](strings/one_edit_distance.py)
- [ ] [rabin_karp](strings/rabin_karp.py)
- [ ] [reverse_string](strings/reverse_string.py)
- [ ] [reverse_vowel](strings/reverse_vowel.py)
- [ ] [reverse_words](strings/reverse_words.py)
- [ ] [roman_to_int](strings/roman_to_int.py)
- [ ] [word_squares](strings/word_squares.py)

- [ ] [tree](tree)
- [ ] [binary_tree](tree/binary_tree)
- [x] [binary_tree](tree/binary_tree/binary_tree)
- [x] [binary_tree_paths](tree/binary_tree/binary_tree_paths)
- [x] [deepest_left](tree/binary_tree/deepest_left)
- [x] [invert_tree](tree/binary_tree/invert_tree)
- [x] [is_balanced](tree/binary_tree/is_balanced)
- [x] [is_same_tree](tree/binary_tree/is_same_tree)
- [x] [is_subtree](tree/binary_tree/is_subtree)
- [x] [is_symmetric](tree/binary_tree/is_symmetric)
- [ ] [longest_consecutive_sequence](tree/binary_tree/longest_consecutive_sequence)
- [ ] [lowest_common_ancestor](tree/binary_tree/lowest_common_ancestor)
- [ ] [max_height](tree/binary_tree/max_height)
- [ ] [min_height](tree/binary_tree/max_height)
- [ ] [path_sum](tree/binary_tree/path_sum)
- [ ] [serialize_deserialize](tree/binary_tree/serialize_deserialize)
- [ ] [traversal](tree/traversal)
- [ ] [inorder](tree/traversal/inorder)
- [ ] [level_order](tree/traversal/level_order)
- [ ] [zigzag](tree/traversal/zigzag)
- [ ] [binary_search_tree](tree/binary_search_tree)
- [ ] [array2bst](tree/binary_search_tree/array2bst)
- [ ] [binary_search_tree](tree/binary_search_tree/binary_search_tree)
- [ ] [bst_closest_value](tree/binary_search_tree/bst_closest_value)
- [ ] [BSTIterator](tree/binary_search_tree/BSTIterator)
- [ ] [delete_node](tree/binary_search_tree/delete_node)
- [ ] [is_valid_bst](tree/binary_search_tree/is_valid_bst)
- [ ] [kth_smallest](tree/binary_search_tree/kth_smallest)
- [ ] [lowest_common_ancestor](tree/binary_search_tree/lowest_common_ancestor)
- [ ] [unique_bst](tree/binary_search_tree/unique_bst)
- [ ] [red_black_tree](tree/red_black_tree)
- [ ] [red_black_tree](tree/red_black_tree)
- [ ] [segment_tree](tree/segment_tree)
- [ ] [segment_tree](tree/segment_tree)
- [ ] [trie](tree/trie)
- [ ] [add_and_search](tree/trie/add_and_search)
- [ ] [trie](tree/trie/trie)

- [x] [union-find](union-find)
- [x] [count_islands](union-find/count_islands.py)

## List of Designs

- [design](design)
- [ ] [alarm_system](design/alarm_system.md)
- [ ] [all_o_one_ds](design/all_o_one_ds.md)
- [ ] [excel_table](design/excel_table.md)
- [ ] [LRUcache](design/LRUcache.md)
- [ ] [nearby_drivers](design/nearby_drivers.md)
- [ ] [ride_sharing](design/ride_sharing.md)
- [ ] [task_runner](design/task_runner.md)
- [ ] [twitter_feeds](design/twitter_feeds.md)

## Contributing

I'd love to have contributors, all feedback is welcome! Take a look at [CONTRIBUTING](CONTRIBUTING.md)

## Additional resources

- [keon/algorithms](https://github.com/keon/algorithms)
- [lndgalante/codewars-katas](https://github.com/lndgalante/codewars-katas)