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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post by answerhappygod »

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);
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply