Create lab16.py

#Your task is to DESCRIBE the missing part of the merge so. So far,
#the function successfully divides the data and sorts the chunks when
#they are smaller than our arbitrary smallest number. Your answer
#should explain how the chunks get merged.

import random

a=[random.randint(0,280) for i in range(100)]

def bubble(items):
    for i in range(len(items)):
        for j in range(len(items)-1):
            if items[j]>items[j+1]:
                items[j],items[j+1]=items[j+1],items[j]
          
def merge(items):

    if len(items)<=60:
        bubble(items)
        return items
    midp=len(items)/2
    lower=merge(items[:midp])
    higher=merge(items[midp:])

    #MERGE GOES HERE
    
    return lower+higher

print a
a=merge(a)
print a

Lab 16
Coventry University 110CT