Giter Club home page Giter Club logo

py-sorts's Introduction

GitHub version

py-sorts

Sort Integers using different sorting algorithms!

Getting Started

Check the releases section to find the latest working zip/tar.

python -m py_sorter [args]

Sorts Available

Sorts Available
Selection Merge Bogo
Bubble Quick Radix
Insertion Recursive Insertion Heap
Shell

Arguments

Argument Description Example
-s / --sort type of sort being performed on list. python -m py_sorter -s radix
-i / --integers provide a list of integers to be sorted. python -m py_sorter -i 9 34 5 4
-g / --generate generate a random list of integers to be sorted. python -m py_sorter -g 1000
-l / --list displays the original/sorted lists. python -m py_sorter -l
-a / --allsorts perform sort on list with each algorithm, except bogo sort. python -m py_sorter -a
-c / --compare display a time comparison between chosen sort and pythons default sorted() function. python -m py_sorter -c

Examples

python -m py_sorter -g 8 -s bogo -l -c

Output:

Shuffles: 63,257
Algorithm: [bogo]
Original List:
468, 846, 801, 976, 261, 641, 72, 698
Sorted List:
72, 261, 468, 641, 698, 801, 846, 976
Time(seconds) bogo: 0.3453168464965863
Time(seconds) sorted(): 3.5189852184980275e-06
bogo was 0.3453133275113678 seconds slower.

python -m py_sorter --generate 10000 --sort quick

Output:

Algorithm: [quick]
Time(seconds): 0.02490532463518387

Caution

  • Be careful when using the Bogo sorting algorithm, it shuffles an array and checks it's been sorted, shuffling infinitely until list is sorted. larger data sets will take a long time (forever).

  • Some algorithms use recursive sub routines to sort, this can lead to RecursionErrors if the data set is very large.

Installing

  • Clone repository locally.
  • python setup.py install.
  • Access module from console with python -m py_sorter [args].

Development

Launching

  • While developing, inside root (/py_sorter) you can test new code changes with:
    • python sorter-runner.py [args]

Testing

  • New tests can be added to the run_all.py file located at (/tests).

  • To run automated tests:

    • python -m run_all

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Resources

Sorting Algorithms

Argument Parsing

py-sorts's People

Contributors

becurrie avatar underhood31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

py-sorts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.