{"id":3601,"date":"2020-11-10T14:17:47","date_gmt":"2020-11-10T14:17:47","guid":{"rendered":"http:\/\/onlineclassesguru.com\/?p=3601"},"modified":"2020-11-10T14:17:47","modified_gmt":"2020-11-10T14:17:47","slug":"bubblesort-algorithm","status":"publish","type":"post","link":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/","title":{"rendered":"BubbleSort algorithm"},"content":{"rendered":"<style type=\"text\/css\"><\/style><p>Questions 1-7 are based on the following program, #include [removed] using namespace std; class cList { public: cList(); ~cList(); cList(int n); int getNum(); cList *previous; cList *next; private: int num; }; cList::cList() \/\/ Question c). cList::~cList() { } \/\/ Question d). cList::cList(int n) \/\/ Question e). int cList::getNum() { return num; } int function1(int m) { return (m%3); } int main() { cList *p1 = new cList(21); cList *p2 = new cList(3); cList *p3 = new cList(80); cList *p4 = new cList(16); p1\u2192previous = p4; p1\u2192next = p2; p2\u2192previous = p1; p2\u2192next = p3; p3\u2192previous = p2; p3\u2192next = p4; p4\u2192next = p1; p4\u2192previous = p3; cList *current = p3; while (current\u2192next != p3) { cout &lt;&lt; function1(current\u2192getNum()) &lt;&lt; &#8220;\\n&#8221;; current = current\u2192next; } while (current\u2192previous != p2) { cout &lt;&lt; function1(current\u2192getNum()) &lt;&lt; &#8220;\\n&#8221;; for (int i=0; i[removed]= 1. c. Implement a function that returns the value of the nth number in this sequence. 9. Suppose there are seven players playing Halo3. They are CatchMeIfYouCan, Halo4, Fake1, SweetGirl, NaughtyBoy, GoldenFinger, and FireBall. Their scores are as indicated in the following Table 1, Name Score CatchMeIfYouCan 1500 Halo4 3500 Fake1 1000 SweetGirl 2200 NaughtyBoy 1960 GoldenFinger 12900 FireBall 5800 Table 1. Players and Scores Now use BubbleSort algorithm to sort the players in the descending order of their scores. Write down\/ draw the table of each intermediate step\/ round and determine how many steps\/ rounds BubbleSort uses totally. (15 points) CatchMeIfYouCan Halo4 Fake1 SweetGirl NaughtyBoy GoldenFinger FireBall GoldenFinger CatchMeIfYouCan Halo4 Fake1 SweetGirl NaughtyBoy FireBall GoldenFinger FireBall CatchMeIfYouCan Halo4 Fake1 SweetGirl NaughtyBoy GoldenFinger FireBall Halo4 CatchMeIfYouCan SweetGirl Fake1 NaughtyBoy GoldenFinger FireBall Halo4 SweetGirl CatchMeIfYouCan NaughtyBoy Fake1 GoldenFinger FireBall Halo4 SweetGirl NaughtyBoy CatchMeIfYouCan Fake1 10. (Bonus points) Is there repetitive\/ unnecessary step\/ round in the above BubbleSort? If there is, how will you suggest avoiding repetitive\/ unnecessary step\/ round in the BubbleSort algorithm? (10 points)<\/p>\n<p><center><a href=\"http:\/\/onlineclassesguru.com\/orders\/ordernow\"><img decoding=\"async\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:ANd9GcTyj99p60XCLyLk1htB7-1neRt8-2QdnenNlQ&usqp=CAU\"target=\"_http:\/\/onlineclassesguru.com\/orders\/ordernow\"\/><\/center><p>","protected":false},"excerpt":{"rendered":"<p>Questions 1-7 are based on the following program, #include [removed] using namespace std; class cList { public: cList(); ~cList(); cList(int n); int getNum(); cList *previous; cList *next; private: int num; }; cList::cList() \/\/ Question c). cList::~cList() { } \/\/ Question d). cList::cList(int n) \/\/ Question e). int cList::getNum() { return num; } int function1(int m)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3601","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>BubbleSort algorithm - onlineclassesguru<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"BubbleSort algorithm - onlineclassesguru\" \/>\n<meta property=\"og:description\" content=\"Questions 1-7 are based on the following program, #include [removed] using namespace std; class cList { public: cList(); ~cList(); cList(int n); int getNum(); cList *previous; cList *next; private: int num; }; cList::cList() \/\/ Question c). cList::~cList() { } \/\/ Question d). cList::cList(int n) \/\/ Question e). int cList::getNum() { return num; } int function1(int m)...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/\" \/>\n<meta property=\"og:site_name\" content=\"onlineclassesguru\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-10T14:17:47+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin_admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/onlineclassesguru.com\/#website\",\"url\":\"https:\/\/onlineclassesguru.com\/\",\"name\":\"onlineclassesguru\",\"description\":\"Cheap Professional coursework and reaction papers help\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/onlineclassesguru.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/#webpage\",\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/\",\"name\":\"BubbleSort algorithm - onlineclassesguru\",\"isPartOf\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#website\"},\"datePublished\":\"2020-11-10T14:17:47+00:00\",\"dateModified\":\"2020-11-10T14:17:47+00:00\",\"author\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\"},\"breadcrumb\":{\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/onlineclassesguru.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"BubbleSort algorithm\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\",\"name\":\"admin_admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/onlineclassesguru.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"caption\":\"admin_admin\"},\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"BubbleSort algorithm - onlineclassesguru","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/","og_locale":"en_US","og_type":"article","og_title":"BubbleSort algorithm - onlineclassesguru","og_description":"Questions 1-7 are based on the following program, #include [removed] using namespace std; class cList { public: cList(); ~cList(); cList(int n); int getNum(); cList *previous; cList *next; private: int num; }; cList::cList() \/\/ Question c). cList::~cList() { } \/\/ Question d). cList::cList(int n) \/\/ Question e). int cList::getNum() { return num; } int function1(int m)...","og_url":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/","og_site_name":"onlineclassesguru","article_published_time":"2020-11-10T14:17:47+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin_admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/onlineclassesguru.com\/#website","url":"https:\/\/onlineclassesguru.com\/","name":"onlineclassesguru","description":"Cheap Professional coursework and reaction papers help","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/onlineclassesguru.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/#webpage","url":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/","name":"BubbleSort algorithm - onlineclassesguru","isPartOf":{"@id":"https:\/\/onlineclassesguru.com\/#website"},"datePublished":"2020-11-10T14:17:47+00:00","dateModified":"2020-11-10T14:17:47+00:00","author":{"@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742"},"breadcrumb":{"@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/bubblesort-algorithm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/onlineclassesguru.com\/"},{"@type":"ListItem","position":2,"name":"BubbleSort algorithm"}]},{"@type":"Person","@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742","name":"admin_admin","image":{"@type":"ImageObject","@id":"https:\/\/onlineclassesguru.com\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","caption":"admin_admin"},"url":"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/"}]}},"_links":{"self":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3601"}],"collection":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/comments?post=3601"}],"version-history":[{"count":1,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3601\/revisions"}],"predecessor-version":[{"id":3602,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3601\/revisions\/3602"}],"wp:attachment":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/media?parent=3601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/categories?post=3601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/tags?post=3601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}