Skip to main content

A learning-focused Python package implementing core algorithms with step-by-step explanations.

Project description

algopract

algopract is a learning-focused Python package that implements core algorithms with optional step-by-step explanations and execution-time profiling.

It is designed to help understand how algorithms work internally, not just produce final results.


Installation

pip install algopract

For local development:

pip install -e .

Usage

Searching Example

result = run_binary_search(
    [1, 2, 3, 4, 5],
    3,
    explain=True,
    profile=True
)

print(result)

Output format:

{
  "algorithm": "Binary Search",
  "result": 2,
  "steps": [...],
  "execution_time_ms": 0.012,
  "expected_complexity": "O(log n)"
}

Sorting Example

from algopract import run_quick_sort

result = run_quick_sort([3, 1, 2])
print(result["result"])

Graph Traversal Example

from algopract import run_bfs

graph = {
    "A": ["B", "C"],
    "B": ["D"],
    "C": [],
    "D": []
}

result = run_bfs(graph, "A")
print(result["result"])

Design Principles

Algorithms return structured data, not printed output

Explanation and profiling are optional

Consistent API across all algorithms

Core logic is separated from presentation

This makes the library suitable for scripts, notebooks, CLI tools, and future UI or visualization layers.

Included Algorithms

Searching: Linear, Binary, Jump, Interpolation

Sorting: Bubble, Selection, Insertion, Merge, Quick

Data Structures: Stack, Queue

Graphs: BFS, DFS

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

algopract-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

algopract-0.1.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file algopract-0.1.0.tar.gz.

File metadata

  • Download URL: algopract-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for algopract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ac6b685dea33407ec0c246ae9a6e3a6a86b3c1883b1046cb21339f4e8225912
MD5 dbacd58d63c888afb7684d885f6ed208
BLAKE2b-256 8aade699943359a577a39962d768ff11577840998cc843f878da431e7a5781c5

See more details on using hashes here.

File details

Details for the file algopract-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: algopract-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for algopract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2874e18d5e46fb1c7c87955b222926e6ba7f84cd8a6faf532beb1e49a4719d84
MD5 125385cbe62bdeaa43dd5ab62ecd7684
BLAKE2b-256 49436fb1bffe70c3ca2f847263a4b9a570f4ae72e3b49e4165de437afddf01cd

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