joseph
joseph

Reputation: 123

How to specify algorithm used to sort a list in python

Can we specify the sorting algorithm to use in python to sort a list. I want to compare multiple sorting algorithm and I don't want to write all by myself. Is there any in build module or any way in python that I can use it to sort the list.

like i want to use buble_sort, insersion-sort, heap-sort etc... I should be able to explictly specify the the algorithm to use.

Upvotes: 0

Views: 123

Answers (1)

Ahasanul Haque
Ahasanul Haque

Reputation: 11134

You can use this, this is quite good.

https://pypi.python.org/pypi/algorithms/0.1

This is fun, like for bubble sort,

from algorithms.sorting import bubble_sort
my_list = bubble_sort.sort(my_list)

Upvotes: 2

Related Questions