Modify the m_sort function such that, m_sort calls m_sort for sub arrays with more than 512 elements, and m_sort calls b
Posted: Fri May 20, 2022 1:47 pm
Modify the m_sort function such that, m_sort calls
m_sort for sub arrays with more than 512 elements, and m_sort calls
b_sort for sub arrays with 512 or less elements.
int data[5395978397]; // REALLY BIG array
void b_sort(int f, int l); // forward declaration
void m_sort(int f, int l) {
int m;
if (f<l) {
m = (f+l)/2;
m_sort(f,m);
m_sort(m+1,l);
merge(f,m,l);
}
}
m_sort for sub arrays with more than 512 elements, and m_sort calls
b_sort for sub arrays with 512 or less elements.
int data[5395978397]; // REALLY BIG array
void b_sort(int f, int l); // forward declaration
void m_sort(int f, int l) {
int m;
if (f<l) {
m = (f+l)/2;
m_sort(f,m);
m_sort(m+1,l);
merge(f,m,l);
}
}