{"id":45090,"date":"2023-03-27T00:19:49","date_gmt":"2023-03-27T00:19:49","guid":{"rendered":"https:\/\/www.oracletutoring.ca\/blog\/?p=45090"},"modified":"2023-03-27T00:19:50","modified_gmt":"2023-03-27T00:19:50","slug":"computer-science-an-idea-about-sorting","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/computer-science-an-idea-about-sorting\/","title":{"rendered":"Computer science: an idea about sorting"},"content":{"rendered":"\n<h2>Self-tutoring about computer science: the tutor mentions a thought about using sorting algorithms.<\/h2>\n<p>\nAmong comparison sorts, merge sort and quicksort are both, for average case, order nlogn, which seems about the best you can get with comparison sorts.<\/p>\n<p>\nWith actual examples I&#8217;ve run, quicksort tended to outperform merge sort. However, I&#8217;m aware that quicksort&#8217;s worst-case performance is order n^2, whereas merge sort&#8217;s is nlogn.<\/p>\n<p>As I understand it, however, the worst case for quicksort is when the input is already sorted and you use the end as a pivot. One can perhaps mitigate this, however, by first using a modified bubble sort, which is of order n when the array is already sorted. Then, if the array is already sorted, you&#8217;re done after running the modified bubble sort; if not, you can apply the quicksort.<\/p>\n<p>Just an idea:)<\/p>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=_KhZ7F-jOlI\">creel<\/p>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=XE4VP_8Y0BU\">Computerphile<\/p>\n<p><a href=\"https:\/\/www.cprogramming.com\/tutorial\/computersciencetheory\/sortcomp.html\">cprogramming.com<\/a><\/p>\nJack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.\n","protected":false},"excerpt":{"rendered":"<p>Self-tutoring about computer science: the tutor mentions a thought about using sorting algorithms. Among comparison sorts, merge sort and quicksort are both, for average case, order nlogn, which seems about the best you can get with comparison sorts. With actual &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/computer-science-an-idea-about-sorting\/\"> <span class=\"screen-reader-text\">Computer science: an idea about sorting<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[],"class_list":["post-45090","post","type-post","status-publish","format-standard","hentry","category-computer-science"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/45090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=45090"}],"version-history":[{"count":3,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/45090\/revisions"}],"predecessor-version":[{"id":45093,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/45090\/revisions\/45093"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=45090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=45090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=45090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}