implemented array mergesort