/algorithmic-practice

In this repo I code many standard algoritmos, just for practice

Primary LanguagePython

algorithmic-practice

This code implements a CLI to test and profile algorithms.

Up to now there are only sorting algorithms.

Sample commands

Command:

`python sorting.py profile -l 10000 -s 100`

Output:

    Testing merge
    Input: [7, 0, 12, 8, 1, 13, 10, 2, 5, 11, 4, 9, 14, 6, 3]
    Output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
    Elapesed time: 4.48226928711e-05, Is good?: True

Command:

`python sorting.py profile -l 10000 -s 100`

Output:

```
Input length|               merge|              bubble|            cocktail
       2|7.15255737304688e-06|1.9073486328125e-06 |5.96046447753906e-06
       4|2.00271606445312e-05|2.14576721191406e-06|2.86102294921875e-06
       8|3.00407409667969e-05|5.00679016113281e-06|5.00679016113281e-06
      16|4.60147857666016e-05|2.50339508056641e-05|1.21593475341797e-05
      32|6.79492950439453e-05|7.00950622558594e-05|5.88893890380859e-05
      64|0.000153064727783203|0.000236988067626953|0.00010991096496582
     128|0.000200986862182617|0.000655889511108398|0.000377178192138672
     256|0.000431060791015625|0.00238204002380371 |0.00140094757080078
     512|0.000930070877075195|0.010408878326416   |0.00540590286254883
    1024|0.00188493728637695 |0.0387370586395264  |0.022104024887085
    2048|0.00437402725219727 |0.153753995895386   |0.0825648307800293
    4096|0.00864100456237793 |0.59312105178833    |0.322674036026001
    8192|0.0190351009368896  |2.38663506507874    |1.32083296775818
```