Explain how the whileloop in the previous definition of the method addlocates the insertion point for the new entry in the array items.

What will be an ideal response?

The loop compares the given search key with the search key of the entries in the array items. The search begins at the last entry in the array and progresses toward the beginning of the array. If the search key of the current entry is greater than the given search key, the entry is moved to the next higher location in the array. If the search key of the current entry either matches or is less than the given search key, the new entry is inserted into the array at the array location just beyond that of the current entry. This location is available for use, because either it is vacant or its former entry was moved to the next higher location by this loop.

Computer Science & Information Technology

You might also like to view...

Changing a value in a cell to see what effect it has on values in other cells that are calculated using the value is said to be doing a

A) why analysis. B) data point analysis. C) 3-D analysis. D) what-if analyis.

Computer Science & Information Technology

Which of the following should be included in the list of contacts in a disaster recovery plan?

A) Customers B) Computer vendor C) Emergency services D) All of the above

Computer Science & Information Technology