can someone explain line 7 and 8 of the insertion sort

Discussion in 'Java' started by Troy, Feb 16, 2008.

  1. Troy

    Troy

    Joined:
    Feb 16, 2008
    Messages:
    2
    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
     
    Troy, Feb 16, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bo
    Replies:
    14
    Views:
    611
    Richard Herring
    Sep 21, 2004
  2. ckfan.painter@gmail.com
    Replies:
    0
    Views:
    520
    ckfan.painter@gmail.com
    Mar 7, 2007
  3. ckfan.painter@gmail.com
    Replies:
    9
    Views:
    431
    Alan Johnson
    Mar 8, 2007
  4. Marc Heiler
    Replies:
    5
    Views:
    126
    Markus Fischer
    Jun 6, 2009
  5. effendi@epitome.com.sg

    Can someone explain this code line to me?

    effendi@epitome.com.sg, Apr 3, 2005, in forum: Javascript
    Replies:
    1
    Views:
    95
    Evertjan.
    Apr 3, 2005
Loading...

Share This Page