algorithms
algorithms copied to clipboard
Minimal examples of data structures and algorithms in Golang
Golang Data Structure and Algorithms
Inspired by Algorithms
Minimal and clean example implementations of data structures and algorithms in Golang.
How to run?
cd <want-algorithm-dir> # cd array
go test -v
Contributing?
Please read CONTRIBUTING.md
List of Implementations
-
array
- [x] circular_counter
- [x] flatten
- [x] garage
- [x] longest_non_repeat
- [x] merge_intervals
- [x] missing_ranges
- [x] plus_one
- [x] rotate_array
- [x] summary_ranges
- [x] three_sum
- [x] two_sum
-
backtrack
- [x] all_perms
- [x] anagram
- [x] array_sum_combinations
- [x] combination_sum
- [x] expression_add_operators
- [x] factor_combinations
- [x] generate_abbreviations
- [x] generate_parenthesis
- [x] letter_combination
- [x] palindrome_partitioning
- [x] pattern_match
- [x] permute
- [x] permute_unique
- [x] subsets
- [x] subsets_unique
- [x] words_search
-
bfs
- [ ] shortest_distance_from_all_buildings
- [ ] word_ladder
-
bit
- [ ] count_ones
- [ ] power_of_two
- [ ] reverse_bits
- [ ] single_number2
- [ ] single_number
- [ ] subsets
-
dfs
- [ ] all_factors
- [ ] count_islands
- [ ] pacific_atlantic
- [ ] sudoku_solver
- [ ] walls_and_gates
-
dp
- [ ] buy_sell_stock
- [ ] climbing_stairs
- [ ] combination_sum
- [ ] house_robber
- [ ] longest_increasing
- [ ] max_product_subarray
- [ ] max_subarray
- [ ] num_decodings
- [ ] regex_matching
- [ ] word_break
-
graph
- [ ] clone_graph
- [ ] find_path
- [ ] graph
- [ ] traversal
-
heap
- [ ] merge_sorted_k_lists
- [ ] skyline
- [ ] sliding_window_max
-
linkedlist
- [ ] add_two_numbers
- [ ] copy_random_pointer
- [ ] delete_node
- [ ] first_cyclic_node
- [ ] is_cyclic
- [ ] is_palindrome
- [ ] kth_to_last
- [ ] linkedlist
- [ ] remove_duplicates
- [ ] reverse
- [ ] rotate_list
- [ ] swap_in_pairs
-
map
- [ ] hashtable
- [ ] longest_common_subsequence
- [ ] randomized_set
- [ ] valid_sudoku
-
math
- [ ] extended_gcd
- [ ] gcd
- [ ] prime_test
- [ ] primes_sieve_of_eratosthenes
- [ ] generate_strobogrammtic
- [ ] is_strobogrammatic
- [ ] nth_digit
- [ ] rabin_miller
- [ ] rsa
- [ ] sqrt_precision_factor
- [ ] pythagoras
-
matrix
- [ ] matrix_rotation.txt
- [ ] bomb_enemy
- [ ] rotate_image
- [ ] sparse_dot_vector
- [ ] sparse_mul
- [ ] spiral_traversal
-
queue
- [ ] max_sliding_window
- [ ] moving_average
- [ ] queue
- [ ] reconstruct_queue
- [ ] zigzagiterator
-
search
- [ ] binary_search
- [ ] count_elem
- [ ] first_occurance
- [ ] last_occurance
-
set
- [ ] randomized_set
-
sort
- [ ] insertion_sort
- [ ] meeting_rooms
- [ ] merge_sort
- [ ] quick_sort
- [ ] selection_sort
- [ ] sort_colors
- [ ] topsort
- [ ] wiggle_sort
-
stack
- [ ] longest_abs_path
- [ ] simplify_path
- [ ] stack
- [ ] valid_parenthesis
-
string
- [ ] add_binary
- [ ] breaking_bad
- [ ] decode_string
- [ ] encode_decode
- [ ] group_anagrams
- [ ] int_to_roman
- [ ] is_palindrome
- [ ] license_number
- [ ] make_sentence
- [ ] multiply_strings
- [ ] one_edit_distance
- [ ] rabin_karp
- [ ] reverse_string
- [ ] reverse_vowel
- [ ] reverse_words
- [ ] roman_to_int
- [ ] word_squares
-
tree
-
segment-tree
- [ ] segment_tree
- [ ] binary_tree_paths
- [ ] bintree2list
-
bst
- [ ] array2bst
- [ ] bst_closest_value
- [ ] BSTIterator
- [ ] delete_node
- [ ] is_bst
- [ ] kth_smallest
- [ ] lowest_common_ancestor
- [ ] predecessor
- [ ] serialize_deserialize
- [ ] successor
- [ ] unique_bst
- [ ] deepest_left
- [ ] invert_tree
- [ ] is_balanced
- [ ] is_subtree
- [ ] is_symmetric
- [ ] longest_consecutive
- [ ] lowest_common_ancestor
- [ ] max_height
- [ ] max_path_sum
- [ ] min_height
- [ ] path_sum2
- [ ] path_sum
- [ ] pretty_print
- [ ] same_tree
-
traversal
- [ ] inorder
- [ ] level_order
- [ ] zigzag
- [ ] tree
-
trie
- [ ] add_and_search
- [ ] trie
-
segment-tree
-
union-find
- [ ] count_islands
List of Designs
-
design
- alarm_system
- all_o_one_ds
- calculator
- excel_table
- LRUcache
- nearby_drivers
- ride_sharing
- task_runner
- twitter_feeds