Skip to content

vhyran/DSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Data Structures and Algorithms in Zig

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.

Introduction

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.

Why Zig?

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.

Implemented Data Structures

Linear Data Structures

  • Arrays
  • Linked Lists (Singly, Doubly and Circular)
  • Stacks
  • Queues (Simple and Circular)

Non-Linear Data Structures

  • Trees (Binary Tree, Binary Search Tree, AVL Tree)
  • Heaps (Min-Heap, Max-Heap)
  • Graphs (Adjacency List, Adjacency Matrix)

Hashing

  • Hash Tables

Implemented Algorithms

Sorting Algorithms

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Heap Sort

Searching Algorithms

  • Linear Search
  • Binary Search

Graph Algorithms

  • Breadth-First Search (BFS)
  • Depth-First Search (DFS)
  • Dijkstra’s Algorithm
  • Kruskal’s Algorithm
  • Prim’s Algorithm

Other Algorithms

  • Dynamic Programming (Examples: Fibonacci, Knapsack Problem)
  • Divide and Conquer (Examples: Merge Sort, Binary Search)
  • Backtracking (Examples: N-Queens, Sudoku Solver)

Getting Started

Version

  • 0.13.0

Documentation

You can find the official Zig documentation. This documentation provides comprehensive information about the Zig programming language, including its syntax, features, and standard library.

Prerequisites

Install Zig on your system.

Compiling and Running Code

To compile and run an implementation:

zig build-exe <filename>.zig
./<filename>

Contributing

Contributions are welcome! If you’d like to add a new data structure, algorithm, or improve existing implementations, please follow these steps:

  1. Fork this repository.
  2. Create a new branch: git checkout -b feature/<your-feature>.
  3. Commit your changes: git commit -m 'Add new feature'.
  4. Push to the branch: git push origin feature/<your-feature>.
  5. Submit a pull request.

Ensure your code follows the Zig coding standards and includes appropriate comments and test cases.

License

This repository is licensed under the MIT License. See the LICENSE file for details.


Feel free to explore, learn, and contribute!