Originally posted by: EvanB
How do you get the indents to work in the attack code box? It takes all the spacing out.
Obviously you are writing malware.Originally posted by: EvanB
How do you get the indents to work in the attack code box? It takes all the spacing out.
Correct. The top part of the function allocates a new array equal to the size of the original. It then copies the original array into the temporary array and recursively calls itself to sort the temporary array in 2 halves. Once the 2 halves are sorted, it merges the sorted halves back into the original array (l is the index to the first sorted half, r is the index to the second sorted half. It simply walks up the 2 sides of the array, knowing that each side is sorted, taking the lower value from either side to place into the next slot of the original array). The case that breaks the recursion is when an array of 1 or 2 is sorted. If there are 2 elements, they are compared and swapped if necessary (1 element is automatically sorted).Originally posted by: EvanB
Cerebus451:
Well, I can see that it sorts the array, but I'm not that sure how. Is it recursive? It looks like it calls itself. I see that it loops through the array, but I don't know exactly how it does the sorting.
Evan
