Thanks so much everyone.
I've figured it out. It was the recursive bit that got me confused, its a
bit difficult debugging recursive functions.
On Wed, Mar 29, 2017 at 1:36 AM, Steven D'Aprano
wrote:
> On Tue, Mar 28, 2017 at 03:56:16PM +0100, Elo Okonkwo wrote:
> > Can
]
Splitting [44]
Merging [44]
Splitting [55, 20]
Splitting [55]
Merging [55]
Splitting [20]
Merging [20]
Merging [20, 55]
Merging [20, 44, 55]
Merging [20, 31, 44, 55, 77]
Merging [17, 20, 26, 31, 44, 54, 55, 77, 93]
[17, 20, 26, 31, 44, 54, 55, 77, 93]
On Tue, Mar 28, 2017 at 3:56 PM, Elo
]
Merging [20]
Merging [20, 55]
Merging [20, 44, 55]
Merging [20, 31, 44, 55, 77]
Merging [17, 20, 26, 31, 44, 54, 55, 77, 93]
[17, 20, 26, 31, 44, 54, 55, 77, 93]
I have never been more confused
On Tue, Mar 28, 2017 at 3:56 PM, Elo Okonkwo wrote:
> Can someone pls explain this Merge S
Can someone pls explain this Merge Sort Algorithm, especially the Recursive
bit of it.
def mergeSort(alist):
print("Splitting ",alist)
if len(alist)>1:
mid = len(alist)//2
lefthalf = alist[:mid]
righthalf = alist[mid:]
mergeSort(lefthalf)
mergeSort(