Question: / / MERGESORT IMPLEMENTATION: / / void merge ( int data [ ] , size _ t n 1 , size _ t n 2

// MERGESORT IMPLEMENTATION:
//
void merge(int data[], size_t n1, size_t n2)
// Precondition: data is an array (or subarray) with at least n1+ n2 elements.
// The first n1 elements (from data[0] to data[n1-1]) are sorted from
// smallest to largest, and the last n2(from data[n1] to data[n1+ n2-1])
// also are sorted from smallest to largest.
// Postcondition: The first n1+ n2 elements of data have been rearranged to be
// sorted from smallest to largest.
// NOTE: If there is insufficient dynamic memory, then bad_alloc is thrown.
// Library facilities used: cstdlib
{
}
void mergesort(int data[], size_t n)
// Precondition: data is an array with at least n components.
// Postcondition: The elements of data have been rearranged so
// that data[0]<= data[1]<=...<= data[n-1].
// NOTE: If there is insufficient dynamic memory, thenbad_alloc is thrown.
// Library facilities used: cstdlib
{
}
//*************************************************************************
//*************************************************************************
// QUICKSORT IMPLEMENTATION:
//
//*************************************************************************
size_t partition(int data[], size_t n)
{
}
void quicksort(int data[], size_t n)
{
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!