Skip to content

Instantly share code, notes, and snippets.

@qkzk
Created May 22, 2022 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qkzk/a48a9844c7410a4b072c3d44cdf2da84 to your computer and use it in GitHub Desktop.
Save qkzk/a48a9844c7410a4b072c3d44cdf2da84 to your computer and use it in GitHub Desktop.
Visualiser le tri par sélection étape par étape
Display the source blob
Display the rendered blob
Raw
{"cells":[{"metadata":{"trusted":true},"cell_type":"code","source":"from lolviz import *","execution_count":1,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"ma_liste = ['hi', 'mom', {3, 4}, {\"parrt\":\"user\"}]\n\nlistviz(ma_liste)","execution_count":2,"outputs":[{"output_type":"execute_result","execution_count":2,"data":{"text/plain":"<graphviz.files.Source object at 0x1226070>","image/svg+xml":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: G Pages: 1 -->\n<svg width=\"166pt\" height=\"41pt\"\n viewBox=\"0.00 0.00 166.00 41.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 37)\">\n<title>G</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-37 162,-37 162,4 -4,4\"/>\n<!-- node19384240 -->\n<g id=\"node1\" class=\"node\">\n<title>node19384240</title>\n<polygon fill=\"none\" stroke=\"#000000\" stroke-width=\".5\" points=\"158,-33 0,-33 0,0 158,0 158,-33\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"1,-19.5 1,-31.5 20,-31.5 20,-19.5 1,-19.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"1,-19.5 20,-19.5 20,-31.5 \"/>\n<text text-anchor=\"start\" x=\"7.9984\" y=\"-22.4\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">0</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"20,-19.5 20,-31.5 55,-31.5 55,-19.5 20,-19.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"20,-19.5 55,-19.5 55,-31.5 \"/>\n<text text-anchor=\"start\" x=\"34.9984\" y=\"-22.4\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">1</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"55,-19.5 55,-31.5 86,-31.5 86,-19.5 55,-19.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"55,-19.5 86,-19.5 86,-31.5 \"/>\n<text text-anchor=\"start\" x=\"67.9984\" y=\"-22.4\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">2</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"86,-19.5 86,-31.5 157,-31.5 157,-19.5 86,-19.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"86,-19.5 157,-19.5 \"/>\n<text text-anchor=\"start\" x=\"118.9985\" y=\"-22.4\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">3</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"1,-.5 1,-19.5 20,-19.5 20,-.5 1,-.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"20,-.5 20,-19.5 \"/>\n<text text-anchor=\"start\" x=\"3.7922\" y=\"-6.6\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">&#39;hi&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"20,-.5 20,-19.5 55,-19.5 55,-.5 20,-.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"55,-.5 55,-19.5 \"/>\n<text text-anchor=\"start\" x=\"22.8507\" y=\"-6.6\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">&#39;mom&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"55,-.5 55,-19.5 86,-19.5 86,-.5 55,-.5\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"86,-.5 86,-19.5 \"/>\n<text text-anchor=\"start\" x=\"57.6553\" y=\"-6.6\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">{3, 4}</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"86,-.5 86,-19.5 157,-19.5 157,-.5 86,-.5\"/>\n<text text-anchor=\"start\" x=\"87.9093\" y=\"-6.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">{&#39;parrt&#39;: &#39;user&#39;}</text>\n</g>\n</g>\n</svg>\n"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"mon_dico = {ord(c): c for c in 'abcdef'}\n\nobjviz(mon_dico)","execution_count":3,"outputs":[{"output_type":"execute_result","execution_count":3,"data":{"text/plain":"<graphviz.files.Source object at 0x116a800>","image/svg+xml":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: G Pages: 1 -->\n<svg width=\"56pt\" height=\"112pt\"\n viewBox=\"0.00 0.00 56.00 112.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 108)\">\n<title>G</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-108 52,-108 52,4 -4,4\"/>\n<!-- node19384352 -->\n<g id=\"node1\" class=\"node\">\n<title>node19384352</title>\n<polygon fill=\"#fefecd\" stroke=\"#444443\" stroke-width=\".5\" points=\"48,-104 0,-104 0,0 48,0 48,-104\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-87 2,-102 23,-102 23,-87 2,-87\"/>\n<text text-anchor=\"start\" x=\"7.7133\" y=\"-91.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">97 </text>\n<text text-anchor=\"start\" x=\"22.7484\" y=\"-89.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"30,-87 30,-102 46,-102 46,-87 30,-87\"/>\n<text text-anchor=\"start\" x=\"30.9842\" y=\"-91.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;a&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-85 2,-87 46,-87 46,-85 2,-85\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-70 2,-85 23,-85 23,-70 2,-70\"/>\n<text text-anchor=\"start\" x=\"7.7133\" y=\"-74.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">98 </text>\n<text text-anchor=\"start\" x=\"22.7484\" y=\"-72.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"30,-70 30,-85 46,-85 46,-70 30,-70\"/>\n<text text-anchor=\"start\" x=\"30.9842\" y=\"-74.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;b&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-68 2,-70 46,-70 46,-68 2,-68\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-53 2,-68 23,-68 23,-53 2,-53\"/>\n<text text-anchor=\"start\" x=\"7.7133\" y=\"-57.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">99 </text>\n<text text-anchor=\"start\" x=\"22.7484\" y=\"-55.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"30,-53 30,-68 46,-68 46,-53 30,-53\"/>\n<text text-anchor=\"start\" x=\"31\" y=\"-57.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;c&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-51 2,-53 46,-53 46,-51 2,-51\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-36 2,-51 23,-51 23,-36 2,-36\"/>\n<text text-anchor=\"start\" x=\"1.7992\" y=\"-40.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">100 </text>\n<text text-anchor=\"start\" x=\"22.7484\" y=\"-38.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"30,-36 30,-51 46,-51 46,-36 30,-36\"/>\n<text text-anchor=\"start\" x=\"30.9842\" y=\"-40.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;d&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-34 2,-36 46,-36 46,-34 2,-34\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-19 2,-34 23,-34 23,-19 2,-19\"/>\n<text text-anchor=\"start\" x=\"1.7992\" y=\"-23.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">101 </text>\n<text text-anchor=\"start\" x=\"22.7484\" y=\"-21.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"30,-19 30,-34 46,-34 46,-19 30,-19\"/>\n<text text-anchor=\"start\" x=\"30.9842\" y=\"-23.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;e&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-17 2,-19 46,-19 46,-17 2,-17\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"2,-2 2,-17 23,-17 23,-2 2,-2\"/>\n<text text-anchor=\"start\" x=\"1.7992\" y=\"-6.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">102 </text>\n<text text-anchor=\"start\" x=\"22.7484\" y=\"-4.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"30,-2 30,-17 46,-17 46,-2 30,-2\"/>\n<text text-anchor=\"start\" x=\"31\" y=\"-6.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;f&#39;</text>\n</g>\n</g>\n</svg>\n"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"objviz([ma_liste, mon_dico])","execution_count":4,"outputs":[{"output_type":"execute_result","execution_count":4,"data":{"text/plain":"<graphviz.files.Source object at 0xe608e0>","image/svg+xml":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: G Pages: 1 -->\n<svg width=\"185pt\" height=\"185pt\"\n viewBox=\"0.00 0.00 185.00 185.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 181)\">\n<title>G</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-181 181,-181 181,4 -4,4\"/>\n<!-- node15575712 -->\n<g id=\"node1\" class=\"node\">\n<title>node15575712</title>\n<polygon fill=\"#cfe2d4\" stroke=\"#444443\" stroke-width=\".5\" points=\"13,-115 0,-115 0,-81 13,-81 13,-115\"/>\n<polygon fill=\"#cfe2d4\" stroke=\"transparent\" points=\"1.5,-98 1.5,-114 12.5,-114 12.5,-98 1.5,-98\"/>\n<polyline fill=\"none\" stroke=\"#444443\" points=\"1.5,-98 12.5,-98 \"/>\n<text text-anchor=\"start\" x=\"4.4985\" y=\"-102.9\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">0</text>\n<polygon fill=\"#cfe2d4\" stroke=\"transparent\" points=\"1.5,-82 1.5,-98 12.5,-98 12.5,-82 1.5,-82\"/>\n<text text-anchor=\"start\" x=\"4.4985\" y=\"-86.9\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">1</text>\n</g>\n<!-- node19384240 -->\n<g id=\"node2\" class=\"node\">\n<title>node19384240</title>\n<polygon fill=\"#cfe2d4\" stroke=\"#444443\" stroke-width=\".5\" points=\"65.5,-177 52.5,-177 52.5,-111 65.5,-111 65.5,-177\"/>\n<polygon fill=\"#cfe2d4\" stroke=\"transparent\" points=\"54,-160 54,-176 65,-176 65,-160 54,-160\"/>\n<polyline fill=\"none\" stroke=\"#444443\" points=\"54,-160 65,-160 \"/>\n<text text-anchor=\"start\" x=\"56.9985\" y=\"-164.9\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">0</text>\n<polygon fill=\"#cfe2d4\" stroke=\"transparent\" points=\"54,-144 54,-160 65,-160 65,-144 54,-144\"/>\n<polyline fill=\"none\" stroke=\"#444443\" points=\"54,-144 65,-144 \"/>\n<text text-anchor=\"start\" x=\"56.9985\" y=\"-148.9\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">1</text>\n<polygon fill=\"#cfe2d4\" stroke=\"transparent\" points=\"54,-128 54,-144 65,-144 65,-128 54,-128\"/>\n<polyline fill=\"none\" stroke=\"#444443\" points=\"54,-128 65,-128 \"/>\n<text text-anchor=\"start\" x=\"56.9985\" y=\"-132.9\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">2</text>\n<polygon fill=\"#cfe2d4\" stroke=\"transparent\" points=\"54,-112 54,-128 65,-128 65,-112 54,-112\"/>\n<text text-anchor=\"start\" x=\"56.9985\" y=\"-116.9\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">3</text>\n</g>\n<!-- node15575712&#45;&gt;node19384240 -->\n<g id=\"edge1\" class=\"edge\">\n<title>node15575712:0&#45;&gt;node19384240:w</title>\n<path fill=\"none\" stroke=\"#444443\" stroke-width=\".5\" d=\"M12.5,-106C35.3379,-106 28.661,-139.3984 47.8095,-143.5732\"/>\n<polygon fill=\"#444443\" stroke=\"#444443\" stroke-width=\".5\" points=\"47.8787,-144.9874 52,-144 48.1625,-142.2019 47.8787,-144.9874\"/>\n</g>\n<!-- node19384352 -->\n<g id=\"node5\" class=\"node\">\n<title>node19384352</title>\n<polygon fill=\"#fefecd\" stroke=\"#444443\" stroke-width=\".5\" points=\"83,-104 35,-104 35,0 83,0 83,-104\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-87 37,-102 58,-102 58,-87 37,-87\"/>\n<text text-anchor=\"start\" x=\"42.7133\" y=\"-91.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">97 </text>\n<text text-anchor=\"start\" x=\"57.7484\" y=\"-89.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"65,-87 65,-102 81,-102 81,-87 65,-87\"/>\n<text text-anchor=\"start\" x=\"65.9842\" y=\"-91.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;a&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-85 37,-87 81,-87 81,-85 37,-85\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-70 37,-85 58,-85 58,-70 37,-70\"/>\n<text text-anchor=\"start\" x=\"42.7133\" y=\"-74.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">98 </text>\n<text text-anchor=\"start\" x=\"57.7484\" y=\"-72.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"65,-70 65,-85 81,-85 81,-70 65,-70\"/>\n<text text-anchor=\"start\" x=\"65.9842\" y=\"-74.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;b&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-68 37,-70 81,-70 81,-68 37,-68\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-53 37,-68 58,-68 58,-53 37,-53\"/>\n<text text-anchor=\"start\" x=\"42.7133\" y=\"-57.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">99 </text>\n<text text-anchor=\"start\" x=\"57.7484\" y=\"-55.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"65,-53 65,-68 81,-68 81,-53 65,-53\"/>\n<text text-anchor=\"start\" x=\"66\" y=\"-57.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;c&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-51 37,-53 81,-53 81,-51 37,-51\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-36 37,-51 58,-51 58,-36 37,-36\"/>\n<text text-anchor=\"start\" x=\"36.7992\" y=\"-40.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">100 </text>\n<text text-anchor=\"start\" x=\"57.7484\" y=\"-38.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"65,-36 65,-51 81,-51 81,-36 65,-36\"/>\n<text text-anchor=\"start\" x=\"65.9842\" y=\"-40.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;d&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-34 37,-36 81,-36 81,-34 37,-34\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-19 37,-34 58,-34 58,-19 37,-19\"/>\n<text text-anchor=\"start\" x=\"36.7992\" y=\"-23.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">101 </text>\n<text text-anchor=\"start\" x=\"57.7484\" y=\"-21.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"65,-19 65,-34 81,-34 81,-19 65,-19\"/>\n<text text-anchor=\"start\" x=\"65.9842\" y=\"-23.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;e&#39;</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-17 37,-19 81,-19 81,-17 37,-17\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"37,-2 37,-17 58,-17 58,-2 37,-2\"/>\n<text text-anchor=\"start\" x=\"36.7992\" y=\"-6.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">102 </text>\n<text text-anchor=\"start\" x=\"57.7484\" y=\"-4.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"65,-2 65,-17 81,-17 81,-2 65,-2\"/>\n<text text-anchor=\"start\" x=\"66\" y=\"-6.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;f&#39;</text>\n</g>\n<!-- node15575712&#45;&gt;node19384352 -->\n<g id=\"edge2\" class=\"edge\">\n<title>node15575712:1&#45;&gt;node19384352:w</title>\n<path fill=\"none\" stroke=\"#444443\" stroke-width=\".5\" d=\"M12.5,-90C30.594,-90 17.7685,-57.7056 31.0313,-52.6596\"/>\n<polygon fill=\"#444443\" stroke=\"#444443\" stroke-width=\".5\" points=\"31.2837,-54.0369 35,-52 30.8246,-51.2748 31.2837,-54.0369\"/>\n</g>\n<!-- node18404032 -->\n<g id=\"node3\" class=\"node\">\n<title>node18404032</title>\n<polygon fill=\"none\" stroke=\"#000000\" stroke-width=\".5\" points=\"153,-163 129,-163 129,-127 153,-127 153,-163\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"130,-147 130,-162 152,-162 152,-147 130,-147\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"130,-147 152,-147 \"/>\n<text text-anchor=\"start\" x=\"134.8912\" y=\"-151.1\" font-family=\"Times,serif\" font-style=\"italic\" font-size=\"11.00\" fill=\"#444443\">set</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"130,-128 130,-147 142,-147 142,-128 130,-128\"/>\n<polyline fill=\"none\" stroke=\"#000000\" points=\"142,-128 142,-147 \"/>\n<text text-anchor=\"start\" x=\"132.9426\" y=\"-134.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">3</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"142,-128 142,-147 152,-147 152,-128 142,-128\"/>\n<text text-anchor=\"start\" x=\"143.9426\" y=\"-134.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">4</text>\n</g>\n<!-- node19384240&#45;&gt;node18404032 -->\n<g id=\"edge3\" class=\"edge\">\n<title>node19384240:2&#45;&gt;node18404032:w</title>\n<path fill=\"none\" stroke=\"#444443\" stroke-width=\".5\" d=\"M65,-136C92.2657,-136 99.5531,-144.1091 124.7898,-144.9327\"/>\n<polygon fill=\"#444443\" stroke=\"#444443\" stroke-width=\".5\" points=\"124.9781,-146.3358 129,-145 125.0229,-143.5362 124.9781,-146.3358\"/>\n</g>\n<!-- node10249256 -->\n<g id=\"node4\" class=\"node\">\n<title>node10249256</title>\n<polygon fill=\"#fefecd\" stroke=\"#444443\" stroke-width=\".5\" points=\"177,-119.5 105,-119.5 105,-100.5 177,-100.5 177,-119.5\"/>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"107,-102 107,-117 137,-117 137,-102 107,-102\"/>\n<text text-anchor=\"start\" x=\"106.7364\" y=\"-106.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\">&#39;parrt&#39; </text>\n<text text-anchor=\"start\" x=\"136.7483\" y=\"-104.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"9.00\" fill=\"#444443\">→</text>\n<polygon fill=\"#fefecd\" stroke=\"transparent\" points=\"144,-102 144,-117 175,-117 175,-102 144,-102\"/>\n<text text-anchor=\"start\" x=\"144.8458\" y=\"-106.1\" font-family=\"Helvetica,sans-Serif\" font-size=\"11.00\" fill=\"#444443\"> &#39;user&#39;</text>\n</g>\n<!-- node19384240&#45;&gt;node10249256 -->\n<g id=\"edge4\" class=\"edge\">\n<title>node19384240:3&#45;&gt;node10249256:w</title>\n<path fill=\"none\" stroke=\"#444443\" stroke-width=\".5\" d=\"M65,-120C81.8933,-120 86.0602,-111.5015 100.965,-110.1736\"/>\n<polygon fill=\"#444443\" stroke=\"#444443\" stroke-width=\".5\" points=\"101.0639,-111.5707 105,-110 100.9435,-108.7733 101.0639,-111.5707\"/>\n</g>\n</g>\n</svg>\n"},"metadata":{}}]},{"metadata":{},"cell_type":"markdown","source":"# Visualiser le tri par sélection"},{"metadata":{"trusted":true},"cell_type":"code","source":"def un_tour_selection(liste, i):\n mini = i\n for j in range(i, len(liste)):\n if liste[j] < liste[mini]:\n mini = j\n liste[mini], liste[i] = liste[i], liste[mini]","execution_count":39,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"i = 0\nliste = ['d', 'c', 'a', 'e', 'b', 'f']","execution_count":50,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Répeter la cellule suivante jusqu'à provoquer une erreur"},{"metadata":{"trusted":true},"cell_type":"code","source":"listviz([])\n\nun_tour_selection(liste, i)\ni = i + 1\n\nprint(liste)\nlistviz(liste)","execution_count":57,"outputs":[{"output_type":"stream","text":"Traceback (most recent call last):\n File \"<input>\", line 3, in <module>\n File \"<input>\", line 6, in un_tour_selection\nIndexError: list index out of range\n","name":"stderr"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"}},"nbformat":4,"nbformat_minor":2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment