go-dsa icon indicating copy to clipboard operation
go-dsa copied to clipboard

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

Data Structures and Algorithms in Go 🚀

tests GitHub License Go Report Card Coverage Report Go Reference

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

📚 Table of Contents

  • Preface
  • Complexity Analysis
  • Data Structures
    • Arrays
      • Reverse Array In-place
      • Add Two Numbers
      • Find Duplicate in Array
      • Zero Sum Triplets
      • Product of All Other Elements
      • Equal Sum Sub-arrays
      • Rotate K Times
      • Bubble Sort
      • Insertion Sort
    • Strings
      • The Longest Dictionary Word Containing Key
      • Look and Tell
      • In Memory Database
      • Number in English
      • Reverse Vowels In a String
      • Longest Substring of Two Unique Characters
      • Roman Numerals
    • Linked Lists
      • Linked List Serialization
      • Reverse a Linked List In-place
      • Join Two Sorted Linked Lists
      • Keep Repetitions
      • Copy Linked List with Random Pointer
      • Implement LRU Cache
    • Stacks
      • Max Stack
      • Balancing Symbols
      • Infix to Postfix Conversion
      • Evaluate Postfix
      • Basic Calculator
      • Longest Valid Parentheses
    • Queues
      • A Queue Using Stacks
      • Implement a Circular Queue Array
      • Is Binary Tree Symmetrical
      • Generate Binary Numbers
      • Find The Maximum Sub-array of Length K
      • String Permutations
    • Hash Tables
      • Find Missing Number
      • List Elements Summing Up to K
      • Fastest Way to Cut a Brick Wall
      • Smallest Missing Positive Integer
      • Find Anagrams
      • Find Max Points on the Same Line
    • Trees
      • Serialize Binary Tree
      • Evaluate A Binary Expression Tree
      • Sorted Array to Balanced BST
      • Traverse Binary Tree
      • Reverse Binary Tree
      • Implement Autocomplete
    • Heaps
      • Kth Largest Element
      • Merge Sorted Lists
      • Median in a Stream
      • Regular Numbers
      • Kth Closest Points to the Center
      • Sliding Maximum
      • Heap Sort
  • Algorithms
    • Recursion
      • Reverse an integer recursively
      • Palindrome
      • Climbing Stairs
      • Exponentiation
      • Multiplication
      • Regular Expressions Matching
      • Expression Operators
    • Divide and Conquer
      • Binary Search
      • Square Root with Binary Search
      • Rate Limit
      • Towers of Hanoi
      • Merge Sort
      • Quick Sort
    • Bit Manipulation
      • Division without multiplication or division operators
      • Middle without division
      • Addition without using plus (+) or any other arithmetic operators
      • Power of Two
      • Maximum without if conditions
      • Oddly Repeated Number
    • Backtracking
      • Permutations
      • Generate Parentheses
      • Phone Letter Combinations
      • Maze
      • Sudoku
      • N Queens
    • Graphs
      • Iteratively Implement BFS and DFS
      • Is Graph a DAG
      • Topological Sort
      • Employee Headcount
      • Remove Invalid Parentheses
      • Cheapest Flights
      • Dijkstra's Algorithm
      • Word Ladder
      • Network Delay Time
      • Number of Islands
      • Dependency Order
    • Greedy Algorithms
      • Maximum Stock Profit
      • Activity Selector
      • Knapsack
      • Jump Game
      • Maximum Number
      • Task Scheduling
    • Dynamic Programming
      • Rod Cutting
      • Sum Up to Number
      • House Robber
      • Interleaving String
      • Minimum Deletion to Make a Palindrome
      • Word Distance

📋 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.