Welcome to the Data Structures and Algorithms (DSA) repository implemented in the Zig programming language! This repository serves as a resource for anyone interested in learning about fundamental DSA concepts and their implementations in Zig.
This repository contains implementations of common data structures and algorithms in Zig. The goal is to provide clean, efficient, and well-documented code that serves as both a learning resource and a utility for developers.
Zig is a modern programming language designed for simplicity, performance, and reliability. Its features include:
- Manual memory management with safety checks
- No hidden control flow or memory allocations
- Compile-time code execution
- Interoperability with C
These features make Zig a great choice for implementing efficient and predictable data structures and algorithms.
- Arrays
- Linked Lists (Singly, Doubly and Circular)
- Stacks
- Queues (Simple and Circular)
- Trees (Binary Tree, Binary Search Tree, AVL Tree)
- Heaps (Min-Heap, Max-Heap)
- Graphs (Adjacency List, Adjacency Matrix)
- Hash Tables
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Linear Search
- Binary Search
- Breadth-First Search (BFS)
- Depth-First Search (DFS)
- Dijkstra’s Algorithm
- Kruskal’s Algorithm
- Prim’s Algorithm
- Dynamic Programming (Examples: Fibonacci, Knapsack Problem)
- Divide and Conquer (Examples: Merge Sort, Binary Search)
- Backtracking (Examples: N-Queens, Sudoku Solver)
- 0.13.0
You can find the official Zig documentation. This documentation provides comprehensive information about the Zig programming language, including its syntax, features, and standard library.
Install Zig on your system.
To compile and run an implementation:
zig build-exe <filename>.zig
./<filename>
Contributions are welcome! If you’d like to add a new data structure, algorithm, or improve existing implementations, please follow these steps:
- Fork this repository.
- Create a new branch:
git checkout -b feature/<your-feature>
. - Commit your changes:
git commit -m 'Add new feature'
. - Push to the branch:
git push origin feature/<your-feature>
. - Submit a pull request.
Ensure your code follows the Zig coding standards and includes appropriate comments and test cases.
This repository is licensed under the MIT License. See the LICENSE file for details.
Feel free to explore, learn, and contribute!