Sorting elements of an array using bubble sort
Algorithm:
Step1: Start
Step2: Read the array elements in a
Step3: Set i=0 and j=0
Step4: Repeat steps 5 and 6 while i<5
Step5: Repeat step 6 while j<5
Step6: if a[i]>a[j+1]
temp=a[i]
a[i]=a[j+1]
a[j+1]=temp
Step7: Print the sorted array
Step8: Stop
Comments
Post a Comment