0% found this document useful (0 votes)
5 views1 page

Bubble Sort Algorithm in Pseudocode

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Bubble Sort Algorithm in Pseudocode

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

START

DECLARATIONS

num [] list = [12, 6, 89, 2, 45]

num temp
IF list[0] != 2 AND list[4] != 89 THEN //First check if the list is already sorted, if not
then procced

FOR num B = 0, B > =4, B++ //Run the check through the entire list
IF list[B + 1] < list[B] THEN // Check if the elements need to be
switched

temp = list[B + 1] //Hold the second element temporarily


list[B+1] = list[B] //Switch the first element into the second
position

list[B] = temp //Set the first position to the second element

ENDIF

ENDFOR

ENDIF
END

You might also like