Metadata-Version: 2.4
Name: numepy
Version: 0.2.0
Summary: Download standalone Python implementations of classic algorithms.
Author: Nikhil Gupta
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Numepy 0.2.0

Numepy lets you download individual Python algorithm files from your terminal.
The algorithms are written in a beginner-friendly style with descriptive
variable names, comments, and small functions.

## Install

```bash
python -m pip install numepy
```

## List algorithms

```bash
numepy list
```

## Download one Python file

```bash
numepy download radixsort
```

This creates `radixsort.py` in your current folder. You can then use it:

```python
from radixsort import radix_sort

numbers = [170, 45, 75, 90, 802, 24, 2, 66]
print(radix_sort(numbers))
```

You can choose a different output filename:

```bash
numepy download radixsort --output my_radix_sort.py
```

## Available commands

| Command | Downloads |
|---|---|
| `mergesort` | `mergesort.py` |
| `quicksort` | `quicksort.py` |
| `bubblesort` | `bubblesort.py` |
| `selectionsort` | `selectionsort.py` |
| `insertionsort` | `insertionsort.py` |
| `countingsort` | `countingsort.py` |
| `radixsort` | `radixsort.py` |
| `strassen2d` | Strassen 2D matrix multiplication |
| `strassen3d` | Batch multiplication of 2D matrices |
| `hiringproblem` | Hiring problem |
| `montecarlo` | Monte Carlo pi estimate |
| `lasvegas` | Las Vegas randomized selection |
| `klargest` / `ksmallest` | K largest / smallest elements |
| `recursiveinorder` | Recursive BST inorder traversal |
| `recursivepreorder` | Recursive BST preorder traversal |
| `recursivepostorder` | Recursive BST postorder traversal |
| `iterativeinorder` | Iterative BST inorder traversal |
| `counttotalnodes` | Count BST nodes |
| `countleafnodes` | Count BST leaf nodes |
| `countinternalnodes` | Count BST internal nodes |
| `findminimum` / `findmaximum` | Binary tree minimum / maximum |
| `bstinsertion` / `bstsearching` | BST insertion / searching |
| `bfs` / `dfs` | Graph traversal |
| `prims` / `kruskal` | Minimum spanning tree |
| `naivepatternsearch` | Naive pattern searching |
| `kmp` | KMP pattern searching |
| `boyermoore` | Boyer-Moore pattern searching |
| `huffmancoding` | Huffman coding |
| `activityselection` | Activity selection |
| `optimalbst` | Optimal binary search tree |
| `rodcutting` | Rod cutting |
| `matrixchain` | Matrix chain multiplication |
| `setcovering` | Greedy set covering |
| `subsetsum` | Subset sum |
| `vertexcover` | Greedy vertex covering |

## Learning notes

- Counting Sort accepts integers, including negative integers.
- Radix Sort accepts non-negative integers.
- Strassen 2D requires equal square matrices whose size is a power of two.
- The `strassen3d` example treats a 3D list as a batch of 2D matrices and
  multiplies matching slices using ordinary matrix multiplication. It is not
  a general 3D tensor multiplication algorithm.
- The Monte Carlo example estimates pi with random points.
- The Las Vegas example uses randomized selection. It returns the correct
  answer, but the running time can vary.
- Set Cover and Vertex Cover use simple greedy approximations, not guaranteed
  optimal solutions.
- The BST files each include their own simple `Node` class.

## Build and publish

```bash
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*
```

The package is prepared locally. It is not published to PyPI until you run
the upload command successfully.
