Look up how to do a bubble sort. Write a method to do a bubble sort of an array of names. See the StringArraySorter class in the directory bookClassesFinal.

What will be an ideal response?

```
/? ?
? Method t o do a b u b b l e s o r t on t h e a r r a y
?/
public void b u b b l e S o r t ( )
{
i n t maxIndex = a . l e n g t h ? 1 ;
i n t numSteps = 0 ;
f o r ( i n t i = maxIndex ; i >= 0 ; i ??)
{
f o r ( i nt j = 0 ; j < i ; j ++)
{
Speed
numSteps++;
i f ( a [ j ] . compareTo ( a [ j +1]) > 0 )
{
swap ( j , j +1);
}
}
t h i s . p r i n t A r r a y ( ” a f t e r l o o p body when i = ” + i ) ;
}
System . out . p r i n t l n ( ”#s t e p s : ”+numSteps ) ;
}

```

Computer Science & Information Technology

You might also like to view...

Windows Firewall is protection built into Windows 10 that can prevent hackers or malicious software from gaining access to your computer through a network or the Internet

Indicate whether the statement is true or false

Computer Science & Information Technology

Use a mail ________ process to create envelopes

A) tab B) combine C) task D) merge

Computer Science & Information Technology