min_index=i;
for(int j=i;j<=n-1;j++)
{
if(a[j]<a[min_index)
{
min_index=j;
}
please explain this as i am unable to understand it.
min_index=i;
for(int j=i;j<=n-1;j++)
{
if(a[j]<a[min_index)
{
min_index=j;
}
please explain this as i am unable to understand it.
@Anku47 we are just keeping track of the index of smallest no in min_index
like array 4 2 3 1 0
min_index at first itr=0;
so after this loop min_index will be 4 as a[4]=0 smallest
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.