sir, why this array has a 2 between the 1s after sorting?
Why this array is not sorted
sir what is the difference it will make by using “else if” instead of “if”
@we_kaash see if you re in this condition:
if(arr[mid]==0)
{
swap(arr[mid],arr[lo]);
lo++;
mid++;
}
then after making changes in that it may be possible the immediate next is condition also gets true so it will also execute as well.
but with else if in one time only one condition will execute.