Commit 5812a4c1 authored by Hrishee Shastri's avatar Hrishee Shastri
Browse files

init readme

parent d6e6d094
# Sorting by Reversals
Sorting by Reversals is a small python program that records the time to sort random permutations using algorithms from the Quantum routing with fast reversals paper: GDC(TBS), GDC(ATBS), OES (odd-even sort).
## Installation
Simply download the repository.
## Usage
To run the program, call ``main(NUM_PERMS_PER_LENGTH, LENGTH_FROM, LENGTH_TO)``` in the ```main.py``` file, where
```NUM_PERMS_PER_LENGTH:``` number of random permutations to run the algorithms on per permutation length
```LENGTH_FROM:``` starting permutation length
```LENGTH_TO:``` ending permutation length
In other words, for each ```N``` from ```LENGTH_FROM``` to ```LENGTH_TO```, the program generates a csv file ```data/len_N_random_perms.csv``` containing ```NUM_PERMS_PER_LENGTH``` permutations.
The resulting csv files will be generated in the ```data/```directory. Each csv file will contain a list of the permutations generated and the corresponding routing times for the three algorithms, GDC(TBS), GDC(ATBS), and OES.
For example, the following may be the output for ```data/len_10_random_perms.csv``` when ```NUM_PERMS_PER_LENGTH``` = 9.
```
Permutation,OES,GDC(TBS),GDC(ATBS)
"2, 3, 9, 6, 8, 5, 1, 10, 4, 7",7,6.666666666666667,7.0
"10, 5, 7, 2, 3, 9, 6, 1, 4, 8",10,8.666666666666666,7.666666666666667
"10, 8, 3, 1, 7, 9, 4, 5, 2, 6",10,8.0,7.666666666666667
"5, 6, 8, 3, 1, 9, 2, 10, 7, 4",7,7.666666666666667,8.0
"3, 10, 7, 9, 8, 2, 1, 6, 4, 5",9,9.0,7.666666666666667
"8, 10, 7, 6, 1, 5, 2, 4, 3, 9",9,8.0,6.666666666666667
"5, 8, 9, 2, 3, 6, 10, 1, 4, 7",7,7.666666666666667,6.333333333333333
"7, 10, 2, 5, 8, 1, 3, 9, 6, 4",8,6.666666666666667,8.666666666666666
"2, 1, 6, 3, 9, 8, 10, 4, 5, 7",5,7.333333333333333,5.0
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment