code I can't find the my mistake, can anyone help:

class ArrayMethods def initialize end def mergeSort(arr=[]) if(arg.length <= 1) return arr; end left=[], right=[], result=[]; x = 0, y = 0; for i in (0..arr.length/2) left[x] = arr[i]; x+1; end for i in (arr.length/2..arr.length) right[y] = arr[i]; y+1; end left = mergeSort(left); right = mergeSort(right); result = merg(left, right); return result; end def merge(left = [], right = []) result=[]; i = 0, j = 0, n = 0; while(i < left.length && j < right.length) if(left[i] <= right[j]) result[n] = left[i]; n+1; i+1; end if(right[j] <= left[i]) result[n] = right[j]; n+1; j+1; end end while(i < left.length) result[n] = left[i] n+1; i+1; end while(j < right.length) result[n] = right[j]; n+1; j+1; end return result; end end

This is btw what I do to run the program:

if __FILE__ == $0 require 'ArrayMethods.rb' # TODO Generated stub arr = [45, 3, 50, 42, 84, 74, 10, 11, 23, 10]; at = ArrayMethods.new; arr2 = at.mergeSort(arr); puts arr2; end