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

https://github.com/spring1843/go-dsa

Go Data Structures and Algorithms is an open source tool for learning and rehearsing data structures and algorithms in Go.
https://github.com/spring1843/go-dsa

algorithms data-structures divide-and-conquer dynamic-programming golang greedy-algorithms learning programming-challenges puzzles recursion

Last synced: 18 days ago
JSON representation

Go Data Structures and Algorithms is an open source tool for learning and rehearsing data structures and algorithms in Go.

Awesome Lists containing this project

README

          

# Data Structures and Algorithms in Go 🚀

[![tests](https://github.com/spring1843/go-dsa/actions/workflows/tests.yaml/badge.svg)](https://github.com/spring1843/go-dsa/actions/workflows/tests.yaml)
[![GitHub License](https://img.shields.io/badge/License-Apache%202.0-ff69b4.svg)](https://github.com/aws/karpenter/blob/main/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/spring1843/go-dsa)](https://goreportcard.com/report/github.com/spring1843/go-dsa)
[![Coverage Report](https://coveralls.io/repos/github/spring1843/go-dsa/badge.svg?branch=main)](https://coveralls.io/github/spring1843/go-dsa?branch=main)
[![Go Reference](https://pkg.go.dev/badge/github.com/spring1843/go-dsa.svg)](https://pkg.go.dev/github.com/spring1843/go-dsa)

![Go-DSA, Go Data Structures and Algorithms](.github/assets/go-dsa-social.png)

Welcome to **Data Structures and Algorithms in Go**! 🎉 This project is designed as a dynamic, hands-on resource for learning and practicing data structures and algorithms in the Go programming language.

* More than one hundred rehearsal problems, at least six problems for each of the fifteen topics
* Executable and comes with 100% test coverage, ensuring correctness and quality
* Completely free, community-editable, and continuously evolving
* Ability to study and practice in your favorite IDE, editor, or web browser

[![Random Challenge](./.github/assets/random_challenge.svg)](https://go.dev/play/p/XEUhCnHtlYF)

## 📚 Table of Contents

* [Preface](./preface.md)
* [Complexity Analysis](./complexity.md)
* Data Structures
* [Arrays](./array/README.md)
* [Reverse Array In-place](./array/reverse_inplace_test.go)
* [Add Two Numbers Represented as Slices](./array/add_slice_of_numbers_test.go)
* [Find Duplicate in Array](./array/find_duplicate_in_array_test.go)
* [Zero Sum Triplets](./array/zero_sum_triplets_test.go)
* [Product of All Other Elements](./array/product_of_all_other_elements_test.go)
* [Equal Sum Sub-arrays](./array/equal_sum_subarrays_test.go)
* [Rotate K Times](./array/rotate_k_steps_test.go)
* [Bubble Sort](./array/bubble_sort_test.go)
* [Insertion Sort](./array/insertion_sort_test.go)
* [Strings](./strings/README.md)
* [The Longest Dictionary Word Containing Key](./strings/longest_dictionary_word_test.go)
* [Look and Tell](./strings/look_and_tell_test.go)
* [In Memory Database](./strings/in_memory_database_test.go)
* [Number in English](./strings/number_in_english_test.go)
* [Reverse Vowels in a String](./strings/reverse_vowels_test.go)
* [Longest Substring of Two Unique Characters](./strings/longest_substring_test.go)
* [Roman Numerals](./strings/roman_numerals_test.go)
* [Linked Lists](./linkedlist/README.md)
* [Linked List Serialization](./linkedlist/serialization_test.go)
* [Reverse Linked List In-place](./linkedlist/reverse_in_place_test.go)
* [Join Two Sorted Linked Lists](./linkedlist/join_sorted_lists_test.go)
* [Keep Repetitions](./linkedlist/keep_repetitions_test.go)
* [Copy Linked List with Random Pointer](./linkedlist/copy_linklist_with_random_pointer_test.go)
* [LRU Cache](./linkedlist/lru_cache_test.go)
* [Stacks](./stack/README.md)
* [Max Stack](./stack/max_stack_test.go)
* [Balancing Symbols](./stack/balancing_symbols_test.go)
* [Infix to Postfix Conversion](./stack/infix_to_postfix_test.go)
* [Evaluate Postfix](./stack/evaluate_postfix_test.go)
* [Basic Calculator](./stack/basic_calculator_test.go)
* [Longest Valid Parentheses](./stack/longest_valid_parentheses_test.go)
* [Queues](./queue/README.md)
* [Queue Using Stacks](./queue/queue_using_stacks_test.go)
* [Circular Queue Array](./queue/circular_queue_using_array_test.go)
* [Symmetrical Binary Tree](./queue/symmetrical_binary_tree_test.go)
* [Generate Binary Numbers](./queue/generate_binary_numbers_test.go)
* [Max Sub-array of size K](./queue/max_of_sub_arrays_test.go)
* [String Permutations](./queue/string_permutations_test.go)
* [Hash Tables](./hashtable/README.md)
* [Find Missing Number](./hashtable/missing_number_test.go)
* [List Elements Summing Up to K](./hashtable/sum_up_to_k_test.go)
* [Fastest Way to Cut a Brick Wall](./hashtable/find_anagrams_test.go)
* [Smallest Missing Positive Integer](./hashtable/smallest_missing_positive_integer_test.go)
* [Find Anagrams](./hashtable/find_anagrams_test.go)
* [Find Max Points on the Same Line](./hashtable/max_points_on_line_test.go)
* [Trees](./tree/README.md)
* [Serialize Binary Tree](./tree/serialize_tree_test.go)
* [Evaluate A Binary Expression Tree](./tree/evaluate_expression_test.go)
* [Sorted Array to Balanced BST](./tree/sorted_array_to_balanced_bsd_test.go)
* [Traverse Binary Tree](./tree/traverse_binary_tree_test.go)
* [Reverse Binary Tree](./tree/reverse_binary_tree_test.go)
* [Autocompletion](./tree/autocompletion_test.go)
* [Heaps](./heap/README.md)
* [Kth Largest Element](./heap/kth_largest_element_test.go)
* [Merge Sorted Lists](./heap/merge_sorted_list_test.go)
* [Median in a Stream](./heap/median_in_a_stream_test.go)
* [Regular Numbers](./heap/regular_numbers_test.go)
* [Kth Closest Points to the Center](./heap/k_closest_points_to_origin_test.go)
* [Sliding Max](./heap/sliding_max_test.go)
* [Heap Sort](./heap/heap_sort_test.go)
* Algorithms
* [Recursion](./recursion/README.md)
* [Reverse an integer recursively](./recursion/reverse_number_test.go)
* [Palindrome](./recursion/is_palindrome_test.go)
* [Climbing Stairs](./recursion/climbing_stairs_test.go)
* [Exponentiation](./recursion/exponentiation_test.go)
* [Multiplication](./recursion/multiplication_test.go)
* [Regular Expression Matching](./recursion/regular_expression_test.go)
* [Expression Operators](./recursion/expression_operators_test.go)
* [Divide and Conquer](./dnc/README.md)
* [Binary Search](./dnc/binary_search_test.go)
* [Square Root with Binary Search](./dnc/square_root_test.go)
* [Rate Limit](./dnc/rate_limit_test.go)
* [Towers of Hanoi](./dnc/towers_of_hanoi_test.go)
* [Merge Sort](./dnc/merge_sort_test.go)
* [Quick Sort](./dnc/quick_sort_test.go)
* [Bit Manipulation](./bit/README.md)
* [Division Without Multiplication or Division Operators](./bit/division_without_operators_test.go)
* [Middle Without Division](./bit/middle_without_division_test.go)
* [Addition Without Arithmetic Operators](./bit/addition_without_operators_test.go)
* [Power of Two](./bit/is_power_of_two_test.go)
* [Max Without Comparison Operators](./bit/max_without_comparison_operators_test.go)
* [Oddly Repeated Number](./bit/oddly_repeated_number_test.go)
* [Backtracking](./backtracking/README.md)
* [Permutations](./backtracking/permutations_test.go)
* [Generate Parentheses](./backtracking/generate_parentheses_test.go)
* [Phone Letter Combinations](./backtracking/phone_letter_combinations_test.go)
* [Maze](./backtracking/maze_test.go)
* [Sudoku](./backtracking/sudoku_test.go)
* [N Queens](./backtracking/n_queens_test.go)
* [Graphs](./graph/README.md)
* [Iteratively BFS and DFS](./graph/iterative_traversal_test.go)
* [DAG Graphs](./graph/is_dag_test.go)
* [Topological Sort](./graph/topological_sort_test.go)
* [Employee Headcount](./graph/employee_headcount_test.go)
* [Remove Invalid Parentheses](./graph/remove_invalid_parentheses_test.go)
* [Cheapest Flights](./graph/cheapest_flights_test.go)
* [Dijkstra's Algorithm](./graph/dijkstra_test.go)
* [Word Ladder](./graph/word_ladder_test.go)
* [Network Delay Time](./graph/network_delay_time_test.go)
* [Number of Islands](./graph/number_of_islands_test.go)
* [Dependency Order](./graph/dependency_order_test.go)
* [Greedy Algorithms](./greedy/README.md)
* [Max Stock Profit](./greedy/max_stock_profit_test.go)
* [Activity Selector](./greedy/activity_selector_test.go)
* [Knapsack](./greedy/knapsack_test.go)
* [Jump Game](./greedy/jump_game_test.go)
* [Max Number](./greedy/max_number_test.go)
* [Task Scheduling](./greedy/task_scheduling_test.go)
* [Dynamic Programming](./dp/README.md)
* [Rod Cutting](./dp/rod_cutting_test.go)
* [Sum Up to Number](./dp/sum_up_to_integer_test.go)
* [House Robber](./dp/house_robber_test.go)
* [Interleaving String](./dp/interleaving_string_test.go)
* [Min Deletions to Make a Palindrome](./dp/min_deletions_to_make_palindrome_test.go)
* [Word Distance](./dp/word_distance_test.go)

## 📋 Outline

All topics are discussed in README.md files in the corresponding directory. Each topic includes the following sections:

* 💡 **Implementation**: Overview of implementing the data structure or algorithm in Go.
* 📊 **Complexity**: Analysis of the time and space complexity of the data structure or algorithm.
* 🎯 **Application**: Discuss problems commonly solved using the data structure or algorithm.
* 📝 **Rehearsal**: Practice problems with links to tests that provide 100% coverage and example inputs and outputs.