{"id":92688,"date":"2022-08-24T00:00:00","date_gmt":"2022-08-24T00:00:00","guid":{"rendered":"https:\/\/nursingstudybay.com\/2022\/08\/24\/programming-assignment\/"},"modified":"2022-08-24T00:00:00","modified_gmt":"2022-08-24T00:00:00","slug":"programming-assignment","status":"publish","type":"post","link":"https:\/\/www.studyproessays.com\/help\/programming-assignment\/","title":{"rendered":"Programming Assignment"},"content":{"rendered":"<p>( Insertion Sort )<\/p>\n<p>This is a simple programming assignment to implement insertion sort algorithm and to observe its worst- case, best-case, and average-case performance. The performance measurement is in terms of the number of key-comparisons, rather than the actual running time.<\/p>\n<p>Implement insertion-sort algorithm without use of recursion. (A recursive implementation of insertion sort for large size n may cause run-time stack overflow.) To keep track of the number of key-comparisons, it is recommended that the sorting algorithm makes use of a Boolean function SMALLER(A, i, j) to do the following:<\/p>\n<p>\u00b7 Increment a global counter, COMPCOUNT, to keep track of the number of key-comparisons per- formed by the algorithm. (This count is initialized to 0 at the beginning of the algorithm.)<\/p>\n<p>\u00b7 Perform a comparison between A[i] and A[j]. Return TRUE if A[i] &lt; A[j]. Otherwise, return FALSE. Carry out the following experiments.<\/p>\n<p>1 Small-Size Array, n = 32.<\/p>\n<p>Run the algorithm for n = 32 and for each of the following cases:<\/p>\n<p>(1) Worst-case data input; (2) Best-case data input; (3) Random data input. (Performance on random data represents average-case.)<\/p>\n<p>For each case, print n, input array, output array (sorted data), and the number of key-comparisons. Does the number of key-comparisons agree with the theoretical values? Theoretically, the worst-cse number of key comparisons is (n2 \u2212 n)\/2, and the average number is (n2 \u2212 n)\/4, which is half of the worst-case.<\/p>\n<p>2 Increasing Array Sizes, n = 100, n = 1000, n = 10000.<\/p>\n<p>Run the algorithm for each of these increasing array sizes and for random data input. For each case, print n and the resulting number of key-comparisons. (Note that for large n, it is not practical to print the actual input\/output arrays! Also, since the algorithm has O(n2) time complexity, an array size larger than 10000 may not be practical.)<\/p>\n<p>( \u2212 )Does the number of key-comparisons show O(n2) performance? That is, when the array size is increased by a factor of 10, does the number of operations (comparisons) increase by approximately a factor of 100? What is the constant factor for the O(n2) performance? Note: Theoretically, the average number of key-comparisons for insertion sort is (n2 n)\/4. Therefore, for large n, the number of comparisons should be approximately n2\/4.<\/p>\n<p>Your program must be in C, C++, or JAVA. Submit your program on Canvas as followd:<\/p>\n<p>1. The source code of your program. (The TA needs to visually read your program to evaluate it, and also run the program to verify that it works.)<\/p>\n<p>( 1 )<\/p>\n<p>2. The output as produced by your program.<\/p>\n<p>3. A short discussion of the results, tabulating the results, and comparing them with the theoretical values.<\/p>\n<p>&#8212;<\/p>\n<p>(Sort by Insertion)<\/p>\n<p>This is a short programming assignment in which you will develop the insertion sort algorithm and evaluate its worst-case, best-case, and average-case performance. The number of key-comparisons is used to measure performance rather than the actual running time.<\/p>\n<p>Implement an insertion-sort method that does not rely on recursion. (For high n, a recursive implementation of insertion sort may result in run-time stack overflow.) It is advised that the sorting algorithm employ the Boolean function SMALLER(A, I j) to do the following to keep track of the number of key-comparisons:<\/p>\n<p>Increase the value of a global counter, COMPCOUNT, to keep track of the number of key-comparisons performed by the algorithm. (This count is initialized to 0 at the beginning of the algorithm.)<\/p>\n<p>\u00b7 Perform a comparison between A[i<\/p>\n","protected":false},"excerpt":{"rendered":"<p>( Insertion Sort ) This is a simple programming assignment to implement insertion sort algorithm and to observe its worst- case, best-case, and average-case performance.\u2026<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7650,7624,1387,7654,667,7649,7652],"tags":[613,7594,1394,7598,7595,7593,7597,7599,7601,7590,7596,7591,7592],"class_list":["post-92688","post","type-post","status-publish","format-standard","hentry","category-assignment-writing-help","category-dissertation-help","category-dissertation-writing-service","category-healthcare-assignment-help","category-nursing-essay","category-research-essay-help","category-write-my-essay-online","tag-best-dissertation-writing-services-uk","tag-cheap-custom-essay-writing-services","tag-custom-research-paper-writers","tag-custom-research-papers-writing-service","tag-essay-writer-websites","tag-essay-writing-service-quality-cheap","tag-free-research-paper-writing-service","tag-help-me-write-a-research-paper","tag-i-need-help-with-my-dissertation","tag-professional-dissertation-writing-service","tag-quick-essay-writing-service","tag-top-rated-dissertation-writing-services","tag-top-uk-dissertation-writing-services"],"_links":{"self":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/posts\/92688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/comments?post=92688"}],"version-history":[{"count":0,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/posts\/92688\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/media?parent=92688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/categories?post=92688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/tags?post=92688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}