Algorisme d'ordenació pel mètode de la inserció
La revisió el 10:40, 2 abr 2024 per Jordi Binefa (discussió | contribucions)
Algorisme
(font)
(font)
a = [1,4,8,9,11,15,7,12,13,6] visualitzaLlista(a) a = ordenaInsercio(a) visualitzaLlista(a)
1 4 8 9 11 15 7 12 13 6 inserta( [1, 4, 8, 9, 11, 15, 7, 12, 13, 6] , 1 , 4 ) inserta( [1, 4, 8, 9, 11, 15, 7, 12, 13, 6] , 2 , 8 ) inserta( [1, 4, 8, 9, 11, 15, 7, 12, 13, 6] , 3 , 9 ) inserta( [1, 4, 8, 9, 11, 15, 7, 12, 13, 6] , 4 , 11 ) inserta( [1, 4, 8, 9, 11, 15, 7, 12, 13, 6] , 5 , 15 ) inserta( [1, 4, 8, 9, 11, 15, 7, 12, 13, 6] , 6 , 7 ) inserta( [1, 4, 7, 8, 9, 11, 15, 12, 13, 6] , 7 , 12 ) inserta( [1, 4, 7, 8, 9, 11, 12, 15, 13, 6] , 8 , 13 ) inserta( [1, 4, 7, 8, 9, 11, 12, 13, 15, 6] , 9 , 6 ) 1 4 6 7 8 9 11 12 13 15
(font)
a = [1,4,8,9,11,15,7,12,13,6] visualitzaLlista(a) a = ordenaInsercio(a) visualitzaLlista(a)