mirror of
https://github.com/jlengrand/Coding4Interviews.git
synced 2026-03-10 08:11:24 +00:00
Starts working on the MergeSort algorithm
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
HashMap Table Implementation
|
||||
|
||||
Collisions are not handled in this version.
|
||||
Collisions are handled in the neighbour and Table versions.
|
||||
|
||||
@jlengrand
|
||||
2013/11
|
||||
|
||||
28
03_MergeSort/ms.py
Normal file
28
03_MergeSort/ms.py
Normal 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
13
03_MergeSort/ms_test.py
Normal 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
|
||||
Reference in New Issue
Block a user