aspose file tools*
The moose likes Java in General and the fly likes Merge Sort Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Merge Sort" Watch "Merge Sort" New topic
Author

Merge Sort

sylvia greene
Ranch Hand

Joined: Jun 23, 2004
Posts: 40
I am trying to implement the merge sort algo.
I have written the following code


I have a slight problem here. If I take the number of elements in "b" array more than number of elements in "a" array, I get a ArrayIndexOutOfBoundsException.I works when both "a" and "b" have same number of elements and when "a" has more elemetnts than "b".
Please help me resolve this .
Kalai Selvan
Ranch Hand

Joined: Jul 07, 2004
Posts: 79
Hi sylvia,

I am not too sure about your logic. But I found two solution for the problem....



I hope this will work....

bye,
Kalai S.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Merge Sort