« Implémentation d'algorithmes classiques/Algorithmes de tri/Tri de Shell » : différence entre les versions

Contenu supprimé Contenu ajouté
DannyS712 (discussion | contributions)
m <source> -> <syntaxhighlight> (phab:T237267)
Ligne 1 :
== GFA [[Programmation Basic|BASIC]] ==
<sourcesyntaxhighlight lang=vb>
PROCEDURE Tri_Shell(N As Int, ByRef E() As Int)
Local Int D, LIMITE, INTERVERSION, J, I
Ligne 21 :
Loop While D > 0 ' sauf si plus possible de diminuer la distance
Return
</syntaxhighlight>
</source>
 
== [[Programmation C|C]] ==
<sourcesyntaxhighlight lang="c">
/*
* Exécute un tri par insertion avec la séparation donnée
Ligne 60 :
shellSortPhase(a, length, gaps[sizeIndex]);
}
</syntaxhighlight>
</source>
 
== [[Programmation C++|C++]] ==
<sourcesyntaxhighlight lang="cpp">
 
/* Réadaptation du code précédent en C++, avec template pour pouvoir s'adapter
Ligne 93 :
}
 
</syntaxhighlight>
</source>
 
== [[Programmation C sharp|C#]] ==
<sourcesyntaxhighlight lang=csharp>
using System;
public class ShellSorter
Ligne 133 :
}
}
</syntaxhighlight>
</source>
 
== [[Programmation Java|Java]] ==
<sourcesyntaxhighlight lang=java>
public static void triDeShell(int [] tab,int tailleLogique){
int pas = 1;
Ligne 161 :
}
}
</syntaxhighlight>
</source>
 
== [[Programmation Pascal|Pascal]] ==
Implémention du tri Shell en Pascal (par ordre croissant).
<sourcesyntaxhighlight lang=pascal>
type
arrayOfInteger = array of integer;
Ligne 201 :
end;
end;
</syntaxhighlight>
</source>
 
== Python ==
Implémentation du tri Shell en Python (par ordre croissant).
 
<sourcesyntaxhighlight lang=python>
def triInsertion(tab, i0=0, dec=1):
"""
Ligne 240 :
for i in range(0, dec):
triInsertion(tab, i, dec)
</syntaxhighlight>
</source>
 
<small>Tout ou partie de cette page est issue de l'article Wikipédia « [[w:Tri_de_Shell|Tri de Shell]] » dans sa [{{fullurl:w:Tri_de_Shell|oldid=54854817}} version du 2 juillet 2010].</small>