Question: Given a one - dimensional array of integers, write an Excel user - defined function that will accept the parameter of a one - dimensional

Given a one-dimensional array of integers, write an Excel user-defined function that will accept the parameter of a one-dimensional array of integers and return a one-dimensional array of the same integers in order from least to greatest using the Insertion Algorithm.
The main procedural trick will be, as we compare our next element from the unordered array with, from right to left, the elements of the newly ordered array and find our next element is less than the one being compared, we must shift the position of the compared element to the right one position in the array. That is, suppose the ordered array has elements (a_1, a_2, a_3,..., a_h-2, a_h-1, a_h) and we have found that our next element from the unordered array, X, is less than a_h. We must change the position of a_h from a_h to a_h +1 before moving along to compare X with a_h-1. If we then find X, greater than or equal to a_h-1, then we can give X position a_h in the ordered array.

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!