BubbleSort_Modofoed_Algorithm
Description
Modified algorithm
Presentation Transcript
Modified Algorithm : Modified Algorithm Step 5 : set i and chk_counter to 0
Step 6 : while(iA[i] ) then do step10 through step13 else do step14
{
Step10 : set temp = A[i] [value of A[j] is stored in a temporary variable ‘temp’]
Step11 : set A[i] = A[j]
Step12 : set A[j] = temp
Step13 : set chk_counter = 1
} [ end of ‘if ’ condition ]
Step14 : add 1 to j [ end of the inner loop ‘j’ ]
} [ end of inside while loop ]
Step15 : if( chk_counter = 0 ) then do step16 else go to step17
{
Step16 : break or go to Step18 [ exit from while loop ]
}
Step17 : add 1 to i [ end of the outer while loop ]
}
Step18 : Print the array
Step19 : end
Your Facebook Friends on WizIQ