{"id":428,"date":"2012-04-27T05:00:12","date_gmt":"2012-04-27T10:00:12","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=428"},"modified":"2012-04-27T06:59:01","modified_gmt":"2012-04-27T11:59:01","slug":"mathematics-and-humanities-understanding-sort-algorithms","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2012\/04\/27\/mathematics-and-humanities-understanding-sort-algorithms\/","title":{"rendered":"Mathematics and Humanities: Understanding Sort Algorithms"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>Steve <a href=\"https:\/\/blogs.mathworks.com\/steve\/2012\/04\/11\/and-now-for-something-completely-different\/\">recently mentioned a video<\/a> showing how the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Quicksort\">quiksort<\/a> algorithm works, including an explanation from Bobby regarding the need for the final seconds to be sure that <tt>NaN<\/tt> values are sorted correctly.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>Contents<\/h3>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"#1\">Visualizing Quiksort<\/a><\/li>\r\n         <li><a href=\"#2\">Visualizing Other Sort Algorithms<\/a><\/li>\r\n         <li><a href=\"#3\">A Place Where Math Meets the Humanities<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <h3>Visualizing Quiksort<a name=\"1\"><\/a><\/h3>\r\n   <p>With much amusement, many of us from MathWorks recently viewed <a href=\"http:\/\/www.youtube.com\/watch?v=ywWBy6J5gz8&amp;feature=share\">this video<\/a> depicting the quiksort algorithm in dance.  I don't think you'll see a MATLAB animation quite like this!\r\n   <\/p>\r\n   <h3>Visualizing Other Sort Algorithms<a name=\"2\"><\/a><\/h3>\r\n   <p>If you are interested in similar visual depictions of other sorting algorithms, check out <a href=\"http:\/\/www.youtube.com\/user\/AlgoRythmics\">this link<\/a>.\r\n   <\/p>\r\n   <h3>A Place Where Math Meets the Humanities<a name=\"3\"><\/a><\/h3>\r\n   <p>In addition to these animations showing off mathematical algorithms, I have also enjoyed listening to and trying my hand at\r\n      <a href=\"http:\/\/en.wikipedia.org\/wiki\/Change_ringing\">change ringing<\/a>.  I find similar points of intersection between my love of math and my interest in other art forms as well.  Also check out\r\n      the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Wallpaper_group\">17 regular tilings of the plane<\/a>.\r\n   <\/p>\r\n   <p>Do you have similar links between some interesting math and art?  Let me know <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=428#respond\">here<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_8b49bbae548d475290e3aaeb35c4b4e9() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='8b49bbae548d475290e3aaeb35c4b4e9 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 8b49bbae548d475290e3aaeb35c4b4e9';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Loren Shure';\r\n        copyright = 'Copyright 2012 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_8b49bbae548d475290e3aaeb35c4b4e9()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.14<br><\/p>\r\n<\/div>\r\n<!--\r\n8b49bbae548d475290e3aaeb35c4b4e9 ##### SOURCE BEGIN #####\r\n%% Mathematics and Humanities: Understanding Sort Algorithms\r\n% Steve\r\n% <https:\/\/blogs.mathworks.com\/steve\/2012\/04\/11\/and-now-for-something-completely-different\/\r\n% recently mentioned a video> showing how the\r\n% <http:\/\/en.wikipedia.org\/wiki\/Quicksort quiksort> algorithm works,\r\n% including an explanation from Bobby regarding the need for the final\r\n% seconds to be sure that |NaN| values are sorted correctly.\r\n%% Visualizing Quiksort\r\n% With much amusement, many of us from MathWorks recently viewed\r\n% <http:\/\/www.youtube.com\/watch?v=ywWBy6J5gz8&feature=share this video>\r\n% depicting the quiksort algorithm in dance.  I don't think you'll see a\r\n% MATLAB animation quite like this!\r\n%% Visualizing Other Sort Algorithms\r\n% If you are interested in similar visual depictions of other sorting\r\n% algorithms, check out <http:\/\/www.youtube.com\/user\/AlgoRythmics this\r\n% link>.\r\n%% A Place Where Math Meets the Humanities\r\n% In addition to these animations showing off mathematical algorithms, I\r\n% have also enjoyed listening to and trying my hand at\r\n% <http:\/\/en.wikipedia.org\/wiki\/Change_ringing change ringing>.  I find\r\n% similar points of intersection between my love of math and my interest in\r\n% other art forms as well.  Also check out the\r\n% <http:\/\/en.wikipedia.org\/wiki\/Wallpaper_group 17 regular tilings of the\r\n% plane>.\r\n%\r\n% Do you have similar links between some interesting math and art?  Let me\r\n% know <https:\/\/blogs.mathworks.com\/loren\/?p=428#respond here>.\r\n##### SOURCE END ##### 8b49bbae548d475290e3aaeb35c4b4e9\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      Steve recently mentioned a video showing how the quiksort algorithm works, including an explanation from Bobby regarding the need for the final seconds to be sure that NaN values are... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2012\/04\/27\/mathematics-and-humanities-understanding-sort-algorithms\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[33,39],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/428"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=428"}],"version-history":[{"count":9,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/428\/revisions"}],"predecessor-version":[{"id":438,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/428\/revisions\/438"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}