Skip to main content
deleted 98 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I apologize in advance for not being able to post this as a comment because I don't have enough rep. I want to point out that you've made a fairly common "mistake" that could rear its ugly head if you decided to transition this code to bottom-up, for instance.

Your midpoint is calculated incorrectly:

int middle = (end-start)/2;

It should be:

int middle = (end+start)/2;

I apologize in advance for not being able to post this as a comment because I don't have enough rep. I want to point out that you've made a fairly common "mistake" that could rear its ugly head if you decided to transition this code to bottom-up for instance.

Your midpoint is calculated incorrectly:

int middle = (end-start)/2;

should be:

int middle = (end+start)/2;

I want to point out that you've made a fairly common "mistake" that could rear its ugly head if you decided to transition this code to bottom-up, for instance.

Your midpoint is calculated incorrectly:

int middle = (end-start)/2;

It should be:

int middle = (end+start)/2;
Source Link

I apologize in advance for not being able to post this as a comment because I don't have enough rep. I want to point out that you've made a fairly common "mistake" that could rear its ugly head if you decided to transition this code to bottom-up for instance.

Your midpoint is calculated incorrectly:

int middle = (end-start)/2;

should be:

int middle = (end+start)/2;