 Kokoma algorithme pona ko classer array ya ba nombres entiers oyo epesami.
Tala ndakisa ya algorithme ya kosala triage ya array oyo epesami na ordre ascendant na nzela ya méthode Bubble Sort : 1. Zwa array ya entrée pe koyeba bolai na yango (na cas oyo, 7). 2. Salá boucle mpo na ko iterer na kati ya array kobanda na élément ya liboso tii na élément ya mibale ya suka. 3. Pona iterations moko na moko, sala boucle mosusu pona ko iterer kobanda na élément ya liboso tii na élément ya suka oyo e classer te na array. 4. Kokanisa élément ya lelo na élément oyo elandi, soki élément ya lelo eleki élément oyo elandi, swap bango. 5. Zongela ba étapes 3-4 tii tango ba éléments nionso ekozala classé na ordre ya komata. 6. Zongisa array oyo ebongisami. Tala algorithme oyo esalemi na code: ``` def bubbleSort(arr): n = len(arr) pona i na range(n): pona j na range(0, ni-1): soki arr[j] > arr [j + 1]: arr [j], arr [j + 1] = arr [j + 1], arr [j] zongisa arr arr = [3, 7, 1, 0, 4, 9, 8] array_ebongisami = bubbleSort(arr) print(sorted_array) ``` Bobimisi ekozala: [0, 1, 3, 4, 7, 8, 9]