Data Structures and Algorithms in Go
This repository contains implementations of various data structures and algorithms in Go programming language. It serves as both a learning resource and a practical reference for developers.
π Data Structures
Basic Data Structures
- Linked List
- Singly Linked List
- Doubly Linked List
- Circular Linked List
- Stack
- Array-based implementation
- Linked List-based implementation
- Queue
- Simple Queue
- Priority Queue
- Circular Queue
- Tree
- Binary Tree
- Binary Search Tree (BST)
- AVL Tree
- Heap
- Hash
- Hash Table
- Hash Map implementations
Advanced Data Structures
- Graph
- Adjacency Matrix
- Adjacency List
- Graph Algorithms
- Depth First Search (DFS)
- Breadth First Search (BFS)
- Topological Sort
- Shortest Path Algorithms
π§ Algorithms
Sorting Algorithms
- Bubble Sort
- Selection Sort
- Insertion Sort
- Quick Sort
- Merge Sort
- Heap Sort
Searching Algorithms
- Linear Search
- Binary Search
- Interpolation Search
π Getting Started
Prerequisites
Installation
git clone https://github.com/mstgnz/data-structures.git
cd data-structures
go mod download
Running Tests
go test ./...
π Usage Examples
You can find example implementations in the examples
directory. Each data structure and algorithm includes its own test files demonstrating usage patterns.
// Example: Creating and using a Binary Search Tree
import "github.com/mstgnz/data-structures/tree"
bst := tree.NewBST()
bst.Insert(5)
bst.Insert(3)
bst.Insert(7)
π€ Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on how to submit pull requests.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Project Structure
.
βββ algorithms/ # Basic algorithm implementations
βββ advanced/ # Advanced data structures
βββ examples/ # Usage examples
βββ graph/ # Graph implementations
βββ hash/ # Hash table implementations
βββ heap/ # Heap implementations
βββ linkedlist/ # Linked list implementations
βββ queue/ # Queue implementations
βββ stack/ # Stack implementations
βββ tree/ # Tree implementations
βββ utils/ # Utility functions
β¨ Features
- Clean and efficient implementations
- Comprehensive test coverage
- Well-documented code
- Generic implementations where applicable
- Performance optimized
- Thread-safe implementations where necessary
Each implementation includes performance considerations and Big O notation analysis in its respective documentation.
π Version History
See CHANGELOG.md for release history and version details.