Starts working on the MergeSort algorithm

This commit is contained in:
julien lengrand-lambert
2013-12-05 15:53:17 +01:00
parent 00268eabc7
commit c6abd4b2a1
3 changed files with 42 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
""" """
HashMap Table Implementation HashMap Table Implementation
Collisions are not handled in this version. Collisions are handled in the neighbour and Table versions.
@jlengrand @jlengrand
2013/11 2013/11

28
03_MergeSort/ms.py Normal file
View File

@@ -0,0 +1,28 @@
"""
Implementation of the MergeSort algorithm
@jlengrand
2013/12
"""
class TableSorter():
"""
A utili=ty that provides way to sort arrays of elements.
It should be possible to compare elements to each others
(meaning a > b and a == b should make sense).
"""
#empty for now
def __init__(self):
pass
def mergeSort(self, table, idx_min=1, idx_max=None):
"""
Returns the table array sorted between
indices idx_min and idx_max using the merge sort algorithm
"""
if idx_max == None:
idx_max = len(table)
#TODO: Implement
return None

13
03_MergeSort/ms_test.py Normal file
View File

@@ -0,0 +1,13 @@
"""
Unit Tests for the MergeSort implementation
@jlengrand
2013/12
"""
from ms import TableSorter
import unittest
class test_table_sorter(unittest.TestCase):
#TODO: Implement