Metadata-Version: 2.1
Name: big-O-calculator
Version: 0.0.1
Summary: A calculator to predict big-O of sorting functions
Home-page: https://github.com/Alfex4936
Author: Seok Won
Author-email: tjrdnjs33936@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3
Description-Content-Type: text/markdown

# Big-O Caculator

A big-O calculator to estimate time complexity of sorting arrays.

inspired by : https://github.com/ismaelJimenez/cpp.leastsq

# Usage

You can call which array to test

```py
Big-O calculator

Args:
    functionName ([string]): function name to call
    array ([string]): "random", "sorted", "reversed", "partial"

```

```py
from bigO import bigO

def bubbleSort(array):  # in-place | stable
    """
    Best : O(n) | O(n) Space
    Average : O(n^2) | O(n) Space
    Worst : O(n^2) | O(n) Space
    """
    isSorted = False
    i = 0
    while not isSorted:
        isSorted = True
        for j in range(len(array) - 1 - i):
            if array[j] > array[j + 1]:
                array[j], array[j + 1] = array[j + 1], array[j]
                isSorted = False

    return array

tester = bigO.bigO()
complexity, _ = tester.test(bubbleSort, "random")

print(complexity)  # O(N^2)

```

