Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Merge Sort

 
sylvia greene
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic