Merge sort arguments??

Posted on 2003-10-28
Last Modified: 2010-04-02
Which elements in the array are the arguments int left and int right referring to?
The first and last indexes?

template <class type>
void mergesort(type a[], int left, int right)
      int mid=(left + right)/2;
      mergesort(a, left, mid);
      mergesort(a, mid+1, right);
Question by:killer455
  • 2

Accepted Solution

n_fortynine earned 25 total points
ID: 9637857
>> The first and last indexes
... of the segment you're "sorting"

Author Comment

ID: 9638652
So basically if sorting an array of 10 elements you would pass
mergsort(Array, Array[0], Array[9])


Expert Comment

ID: 9638718
no, (Array, 0, 9); -> the *indexes* not the *values contained in the indexes*

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Building cUrl in Windows v7.43.0 4 39
C++ dll will not run on machine without VS installed 10 93
Find Visual Studio Tools 2 124
convert char array to number in c 5 91
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question