From: Haofei Date: 2006-09-13T19:10:59+09:00 Subject: merge_sort problem here is the merge_sort i write in ruby. but it doesn't produce the right answer, i can't find where the problem is . thanks in advance def merge(a, p, q, r) a1=a[0..(q-p)] a2=a[(q-p+1)..r] a1<<99999999 a2<<99999999 i=j=0 for k in (p..r) if a1[i]<=a2[j] a[k]=a1[i] i=i+1 else a[k]=a2[j] j=j+1 end end end def merge_sort(a,p,r) if p