{"id":3145,"date":"2026-05-04T10:53:16","date_gmt":"2026-05-04T08:53:16","guid":{"rendered":"https:\/\/labodemaths.fr\/WordPress3\/?p=3145"},"modified":"2026-05-04T10:54:37","modified_gmt":"2026-05-04T08:54:37","slug":"nsitri-par-selection","status":"publish","type":"post","link":"https:\/\/labodemaths.fr\/WordPress3\/nsitri-par-selection\/","title":{"rendered":"NSI,Tri par s\u00e9lection"},"content":{"rendered":"\n<p> <a rel=\"noreferrer noopener\" aria-label=\"l'article sur les algorithmes de tris de la revue Interstice (s\u2019ouvre dans un nouvel onglet)\" href=\"https:\/\/interstices.info\/les-algorithmes-de-tri\/#:~:text=Selon%20le%20dictionnaire%2C%20%C2%AB%20trier%20%C2%BB,plusieurs%20classes%20selon%20certains%20crit%C3%A8res%20%C2%BB.&amp;text=Par%20exemple%2C%20trier%20N%20entiers,suite%20d'%C3%A9l%C3%A9ments%20%C3%A0%20trier.\" target=\"_blank\">article sur les algorithmes de tris<\/a> <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from random import *\ndef liste_aleatoire(n):\n    '''\n    renvoie une liste de n nombres al\u00e9atoires\n    entre 0 et n\n    &gt;&gt;&gt;liste_aleatoire(5)\n    &#91;2,2,0,4,0]\n    '''\n    return &#91;randint(0,n) for i in range(n)]\n\ndef est_triee(liste):\n    '''\n    &gt;&gt;&gt;est_triee(&#91;2,5,12])\n    True\n    &gt;&gt;&gt;est_triee(&#91;5,2,12])\n    False\n    '''\n    if liste==liste.sort():\n        return True\n    else:\n        return False\n    \ndef tri_selection(liste):\n    for i in range(len(liste)):\n        print(liste)\n        ind_min=i\n        for j in range(i+1,len(liste)):\n            if liste&#91;j]&lt;liste&#91;ind_min]:\n                ind_min=j\n        liste&#91;i],liste&#91;ind_min]=liste&#91;ind_min],liste&#91;i]\n   \n   \n   \n   \n   \n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>article sur les algorithmes de tris<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/3145"}],"collection":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/comments?post=3145"}],"version-history":[{"count":3,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/3145\/revisions"}],"predecessor-version":[{"id":3148,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/3145\/revisions\/3148"}],"wp:attachment":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/media?parent=3145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/categories?post=3145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/tags?post=3145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}