can someone explain line 7 and 8 of the insertion sort

Joined
Feb 16, 2008
Messages
2
Reaction score
0
public void insertionSort(int arr[]) {
int temp;
for(int k=1; k<arr.length; k++){
temp = arr[k];
int i;
for( i = k-1; i>=0&&arr> temp; i--)
arr[i+1] = arr;
arr[i+1] = temp;
}}
//when i trace through this code i can explain y
//line 7 and 8 does what it does
//please break it down for me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top