Look up how to do an insertion sort. Write a method to do a insertion sort of an array of names. See the StringArraySorter class in the directory bookClass- esFinal.
What will be an ideal response?
```
/**
* Method to do an i n s e r t i o n s o r t on the ar ray
*/
public void i n s e r t i o n S o r t ( )
{
St r ing temp = nul l ;
int pos = 0 ;
// loop from second element on
for ( int i = 1 ; i < a . l eng th ; i++)
{
// save cur r ent v a lue at i and s e t p o s i t i o n to i
temp = a [ i ] ;
pos = i ;
// s h i f t r i g h t any l a r g e r e l ement s
while (0 < pos && temp . compareTo ( a [ pos ¡ 1 ] ) < 0)
{
a [ pos ] = a [ pos ¡ 1 ] ;
pos¡¡;
}
a [ pos ] = temp ;
this . pr intAr ray ( " a f t e r loop body when i = " + i ) ;
}
}
```
You might also like to view...
____ documents retain the original layout of text and graphics, so they are sometimes referred to as a fixed-layout format.
A. PDF B. HTML C. Word processing D. DOCX
Another term for pre-employment screening is a(n) ________ check
Fill in the blank(s) with correct word
The symbols for a Turing machine must come from a finite set of symbols called the tape ____.
A. alphabet B. placeholder C. blank D. palette
An End Case statement is used to terminate a Select Case structure.
Answer the following statement true (T) or false (F)