Bosala algorithme oyo e classer array oyo epesami na ordre ascendant.
Tala ndakisa ya algorithme ya triage simple oyo babengi Bubble Sort, oyo ekoki ko classer array oyo epesami na ordre ascending: ``` 1. Kobanda 2. Tyá 'n' lokola bolai ya array ya entrée 3. Zongela ba étapes 4 à 6 'n ' mbala 4. Set 'i' na 0 5. Tango 'i' ezali moke koleka 'n' - 1 6. Soki élément na index 'i' ezali monene koleka élément na index 'i+1', alors swap ba éléments wana 7 .Kobakisa 'i' na 1 8. Suka ``` Tosala algorithme oyo pona array ya entrée oyo epesami : [4, 5, 2, 1, 3] n = 5 - Iterations ya liboso : Kokanisa ba éléments adjacents pe swap soki esengeli - . 4 na 5 ezali na ordre, swap moko te - 5 na 2 ezali na ordre te, swap bango, array ekomi sikoyo [4, 2, 5, 1, 3] - 5 na 1 ezali na ordre te, swap bango, array sikoyo ekomi [4, 2, 1, 5, 3] - 5 na 3 ezali na ordre te, swap yango, array ekomi sikoyo [4, 2, 1, 3, 5] - Suka ya iterations ya liboso, élément ya munene ezali na position na yango ya malamu - Iterations ya mibale : Kokanisa ba éléments adjacents (sauf oyo ya suka) pe swap soki esengeli - 4 na 2 ezali na ordre te, swap yango, array ekomi sikoyo [2, 4, 1, 3, 5] - 4 na 1 ezali na ordre te, swap yango, array ekomi sikoyo [2, 1, 4, 3, 5] - 4 na 3 ezali na ordre te, swap yango, array ekomi sikoyo [2, 1, 3, 4 , 5] - Suka ya iterations ya mibale, élément ya mibale ya munene ezali na position na yango ya malamu - Iterations ya misato : Kokanisa ba éléments adjacents (sauf mibale ya suka) pe swap soki esengeli - 2 na 1 ezali na ordre te, swap yango, array ekomi sikoyo [1, 2, 3, 4, 5] - Oyo etikali ya