This is an excerpt from Insertion sort program. Below are given three code fragments, which are different version of same function, and ought to give same output; unfortunately, only the 2nd and 3rd code fragments give the expected output. Why does code fragment 1 act differently?

```
int find_smallest_index(int get_array[],int size,int left_index)    //1st        
{   
    int index_of_smallest_value;
    for(int right_index=left_index+1;right_index<size;right_index++)
      {
        if(get_array[right_index]<get_array[left_index])
        {index_of_smallest_value=right_index;}
      }
    return index_of_smallest_value;
 }

int find_smallest_index(int get_array[],int size,int left_index)   //2nd         
{   

    for(int right_index=left_index+1;right_index<size;right_index++)
    {
        if(get_array[right_index]<get_array[left_index]) 
        {left_index=right_index;}
    }
    return left_index;
}

int find_smallest_index(int get_array[],int size,int left_index)   //3rd           
{   int index_of_smallest_value=left_index;
    for(int right_index=left_index+1;right_index<size;right_index++)
    {
        if(get_array[right_index]<get_array[index_of_smallest_value]) 
        {index_of_smallest_value=right_index;}
    }
    return index_of_smallest_value;
}

```