Question: write a c + + function: int insert _ into _ sorted ( int source [ ] , int source _ len, int destination [

write a c++ function: int insert_into_sorted(int source[], int source_len, int destination[], int new_elem) The insert_into_sorted function fills a new array by copying values from an array of ASCENDING order sorted values and inserting a value into the correct position so the values in the new array remain sorted in ASCENDING order. The function takes four arguments: 1. an array of integers that holds the sorted values (source in the header)2. an integer that represents the number of values that the source array contains (source_len)3. an array of integers that the values should be copied into (destination)4. an integer that represents the number to be inserted (new_elem) The function returns an integer: 0 if the number of values that the source array contains is less than 1, otherwise it returns 1. It is okay to assume that the array that is being filled (destination) has been properly declared to have room for the values from the source array and the inserted value.

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 Programming Questions!