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
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top