Why iteration started from 1

why did we start iteration from 1 and not from 0

We started the variable itr from 1 not from 0 because we know that after the first itr we need not check the last element and it will get largest element on its own. Last element is 1st from last that’s why we started from 1 because it will get sorted automatically. starting from 0 makes no sense because last 0 sorted elements doesnt mean anything. Moreover you are swapping jth and(j+1) th element so if you go on last element …with which element will it get swapped.