{"id":417,"date":"2022-01-17T14:58:05","date_gmt":"2022-01-17T13:58:05","guid":{"rendered":"http:\/\/yb-isn.fr\/2021\/nsi\/?p=417"},"modified":"2022-01-17T15:29:30","modified_gmt":"2022-01-17T14:29:30","slug":"quelques-algorithmes-simples","status":"publish","type":"post","link":"http:\/\/yb-isn.fr\/2021\/nsi\/?p=417","title":{"rendered":"Quelques algorithmes simples"},"content":{"rendered":"<p><!--more--><\/p>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2020\/02\/fe2299c7-aurelie-e1580980311835.png\" alt=\"\" class=\"wp-image-960\" width=\"225\" height=\"220\"\/><\/figure>\n\n\n\n<p class=\"has-very-light-gray-background-color has-background has-medium-font-size\">1) Introduction<\/p>\n\n\n<div style=\"position:relative;padding-bottom:56.25%;padding-top:10px;height:0;overflow:hidden;\"><iframe loading=\"lazy\" src=\"https:\/\/www.canal-u.tv\/video\/inria\/embed.1\/1_4_qu_est_ce_qu_un_algorithme.24552?width=100%&amp;height=100%\" style=\"position:absolute;top:0;left:0;width:100%;height: 100%;\" allowfullscreen=\"\" scrolling=\"no\" width=\"550\" height=\"306\" frameborder=\"0\"><\/iframe><\/div>\n<p><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-761\" src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2019\/12\/activit\u00e9.png\" alt=\"\" width=\"61\" height=\"45\"><\/a><\/p>\n<p><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html\">https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html<\/a><\/p>\n\n\n<p class=\"has-very-light-gray-background-color has-background has-medium-font-size\">2) Tri par insertion ,par s\u00e9lection<\/p>\n\n\n<p><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-761\" src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2019\/12\/activit\u00e9.png\" alt=\"\" width=\"61\" height=\"45\"><\/a><\/p>\n<p><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_tri_algo.html\">https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_tri_algo.html<\/a><\/p>\n<p><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-761\" src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2019\/12\/activit\u00e9.png\" alt=\"\" width=\"61\" height=\"45\"><\/a><\/p>\n<p>\u00e0 l&rsquo;aide cartes (post-it) assurez vous d&rsquo;avoir bien compris ces deux algorithmes de tris.<\/p>\n<p>vous pourrez \u00e9ventuellement r\u00e9aliser une vid\u00e9o.<\/p>\n\n\n<p class=\"has-very-light-gray-background-color has-background has-medium-font-size\">3) Exercices<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html\"><img src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2019\/12\/activit\u00e9.png\" alt=\"\" class=\"wp-image-761\"\/><\/a><\/figure>\n\n\n\n<p>Pour chacune des questions qui suivent \u00e9crire un algorithme permettant de r\u00e9soudre le probl\u00e8me puis codez le en python.<\/p>\n\n\n\n<p>3 1) trouver l&rsquo;indice d&rsquo;une valeur donn\u00e9e dans un tableau<\/p>\n\n\n\n<p>3 2) \u00c9crire une fonction qui retourne le minimum d&rsquo;un tableau<\/p>\n\n\n\n<p>3 3) \u00c9crire une fonction qui retourne le maximum d&rsquo;un tableau <\/p>\n\n\n\n<p>3 4) \u00c9crire une fonction qui renvoi le min et le max d&rsquo;un tableau<\/p>\n\n\n\n<p>3 5)  \u00c9crire une fonction qui \u00e9change 2 valeurs  d&rsquo;un tableau <\/p>\n\n\n\n<p><a href=\"https:\/\/colab.research.google.com\/drive\/1nHDcxOtOS17GyMYRJpKJ1AhiFcw-Db8l\">corrig\u00e9<\/a><\/p>\n\n\n\n<p class=\"has-very-light-gray-background-color has-background has-medium-font-size\">4) Efficacit\u00e9 des tris<\/p>\n\n\n<p><a href=\"https:\/\/pixees.fr\/informatiquelycee\/n_site\/nsi_prem_intro_algo.html\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-761\" src=\"http:\/\/yb-isn.fr\/nsi2019\/wp-content\/uploads\/2019\/12\/activit\u00e9.png\" alt=\"\" width=\"61\" height=\"45\" \/><\/a><\/p>\n<p>Testez et comprendre les codes python ci-dessous<\/p>\n<p><a href=\"http:\/\/lwh.free.fr\/pages\/algo\/tri\/tri_insertion.html\">http:\/\/lwh.free.fr\/pages\/algo\/tri\/tri_insertion.html<\/a><\/p>\n<p><a href=\"http:\/\/lwh.free.fr\/pages\/algo\/tri\/tri_selection.html\">http:\/\/lwh.free.fr\/pages\/algo\/tri\/tri_selection.html<\/a><\/p>\n<p>Pour apprendre \u00e0 ex\u00e9cuter un script \u00ab\u00a0\u00e0 la main \u00a0\u00bb pour mieux le comprendre vous pouvez vous aider de python tutor.<\/p>\n<p><a href=\"http:\/\/pythontutor.com\/visualize.html#mode=edit\">http:\/\/pythontutor.com\/visualize.html#mode=edit<\/a><\/p>\n<p>un exemple :<a href=\"http:\/\/pythontutor.com\/visualize.html#code=def%20tri_insertion%28tableau%29%3A%0A%20%20%20%20for%20i%20in%20range%281,len%28tableau%29%29%3A%0A%20%20%20%20%20%20%20%20en_cours%20%3D%20tableau%5Bi%5D%0A%20%20%20%20%20%20%20%20j%20%3D%20i%0A%20%20%20%20%20%20%20%20%23d%C3%A9calage%20des%20%C3%A9l%C3%A9ments%20du%20tableau%20%7D%0A%20%20%20%20%20%20%20%20while%20j%3E0%20and%20tableau%5Bj-1%5D%3Een_cours%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20tableau%5Bj%5D%3Dtableau%5Bj-1%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20j%20%3D%20j-1%0A%20%20%20%20%20%20%20%20%23on%20ins%C3%A8re%20l'%C3%A9l%C3%A9ment%20%C3%A0%20sa%20place%0A%20%20%20%20%20%20%20%20tableau%5Bj%5D%3Den_cours%0At%3D%5B8,5,23,15%5D%0Atri_insertion%28t%29%0At&amp;cumulative=false&amp;curInstr=0&amp;heapPrimitives=nevernest&amp;mode=display&amp;origin=opt-frontend.js&amp;py=3&amp;rawInputLstJSON=%5B%5D&amp;textReferences=false\" data-rich-text-format-boundary=\"true\">cliquez<\/a><\/p>\n\n\n<p class=\"has-very-light-gray-background-color has-background has-medium-font-size\">5) Exercices de bioinformatique<\/p>\n\n\n<p>5 1) vous disposez d&rsquo;une chaine de caract\u00e8res qui correspond \u00e0 une s\u00e9quence d&rsquo;adn<\/p>\n<p>dna=&rsquo;GTTAATATTCCTCACATGGGTGCGGGAACGAATGCGGGGCAGTCGAA&rsquo;<\/p>\n<p>transformez cette chaine en liste<\/p>\n<p>5 2) \u00c9crire une fonction qui renvoi le nombre d\u2019occurrences d&rsquo;une base donn\u00e9e dans une s\u00e9quence<\/p>\n<p>5 3) \u00c9crire une fonction qui renvoi une liste avec 1 si la base est pr\u00e9sente \u00e0 la position i et 0 dans le cas contraire.&nbsp;<\/p>\n<p>5 4) \u00c9crire une fonction qui renvoi une liste avec les indices de la base recherch\u00e9e dans la s\u00e9quence.<\/p>\n<p>5 5) g\u00e9n\u00e9rer une s\u00e9quence de 100000 bases puis tester vos diff\u00e9rentes fonctions.<\/p>\n\n\n<p><a href=\"https:\/\/colab.research.google.com\/drive\/1u-L2ec3TGCVWS6X_d7yVfnJSOcPVYIpz\">corrig\u00e9<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":421,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/posts\/417"}],"collection":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=417"}],"version-history":[{"count":5,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/posts\/417\/revisions"}],"predecessor-version":[{"id":861,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/posts\/417\/revisions\/861"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=\/wp\/v2\/media\/421"}],"wp:attachment":[{"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yb-isn.fr\/2021\/nsi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}