Skip to main content

A collection of 15 essential C algorithms with a CLI

Project description

C Algorithms Collection

A collection of 15 essential Data Structures and Algorithms (DSA) implemented in C, packaged as a Python library for easy access.

Installation

You can install this collection as a local package:

pip install .

Usage

Once installed, you can use the c-algo command followed by the program number (1-15):

c-algo 1

Or run it directly using Python:

python -m c_programs 1

Available Programs

  1. Binary Search: Efficiently find an element in a sorted array.
  2. Linear Search: Simple search for an element in an array.
  3. Insertion Sort: Stable sorting algorithm with $O(n^2)$ complexity.
  4. Pattern Matching: Naive string searching implementation.
  5. BFS (Breadth First Search): Level-order traversal for graphs.
  6. DFS (Depth First Search): Recursive depth-order traversal for graphs.
  7. Dijkstra's Algorithm: Single-source shortest path for weighted graphs.
  8. Floyd Warshall Algorithm: All-pairs shortest path calculation.
  9. Prim's Algorithm: Finding the Minimum Spanning Tree (MST).
  10. Maximum (Divide & Conquer): Finding the maximum element using recursion.
  11. Heap Sort: Efficient comparison-based sorting using a binary heap.
  12. Quick Sort: Fast divide-and-conquer sorting algorithm.
  13. Traveling Salesperson (Greedy): A greedy approach to the TSP problem.
  14. N-Queens Problem: Backtracking solution for the classic puzzle.
  15. k-th Smallest Element: Finding the k-th smallest element in an unsorted array.

How to Run

To compile and run any program (e.g., Binary Search):

gcc c_programs/binary_search.c -o binary_search
./binary_search

(Note: On Windows, use binary_search.exe instead of ./binary_search)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algorc-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algorc-1.0.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file algorc-1.0.0.tar.gz.

File metadata

  • Download URL: algorc-1.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for algorc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aab948b95d31d7b85f7a792a9ff3bbd0fcd40a1b0edbaf618bf0c9532ac4bb64
MD5 b0986dd1b1b0c96ec056f7cbfea9b652
BLAKE2b-256 96590bdaeb516d523809d114ca0d13942cef07ae5b7fd149cbd239a635b151f4

See more details on using hashes here.

File details

Details for the file algorc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: algorc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for algorc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e54f32de4af7f2266f29effd6bad75d99bbbcfd83e8f974d0ebb7f3d17b1901f
MD5 39df06ea219394402aa60b08f6e7a738
BLAKE2b-256 d7c426c8d15f64e0ef04526915945e6a7bd19b9c4c8e9ebb4e1604a8da9744bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page