COS2611 Assignment 2 Question 16 code:
You are required to choose two sorting algorithms from a specified list the first algorithm must be Bubble Sort, while the second algorithm can be either Merge Sort or Heap Sort.
a) Write a C++ program where you implement the two sorting algorithms you have...
COS2611 2024 ASSIGNMENT Q16
SOLUTION(100% working)
Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187
Copy and run the code and submit what you are suppose to submit
, Question 16
You are required to choose two sorting algorithms from a specified list the first algorithm must be
Bubble Sort, while the second algorithm can be either Merge Sort or Heap Sort.
a) Write a C++ program where you implement the two sorting algorithms you have chosen -ensure
that they are part of the same program and can be called using methods, functions and/or
procedures.
b) Continue in this C++ program and generate random input arrays of different sizes specifically
100, 1000, and 5000 elements.
c) Utlize the implemented TWO sorting algorithms to sort these randomly generated arrays.
d) Generate a report to indicate:
1 The input size (number of elements).
2 The execution time for the two different sorting algorithms.
3 The time complexity formulas for the two different sorting algorithms
Typical output:
Input Size: 100
XXXX Sort: Execution Time: 0.002 seconds
YYYYY Sort: Execution Time: 0.001 seconds
Input Size: 1000
1O00 sort: Execution Time: 0.05 seconds
YYYYYSort: Execution Time: 0.01 seconds
Input Size: 5000
XXXX Sort: Execution Time: 2.5 seconds
YYYYY Sort: Execution Time: 0.1 seconds
The time complexity formula for XXXX: Give the fornula
The time complexity formula for YYYYY: Give the formula
OUTPUT
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller CrystalIndigo. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R93,33. You're not tied to anything after your purchase.