• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Other

COS2611 assignment 2 project solution 2025

Document preview thumbnail
Preview 2 out of 7 pages

SPECIFICATIONS FOR THIS PROJECT 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) Utilize the implemented TWO sorting algorithms to sort these randomly generated arrays. d) Generate a report to indicate: - The input size (number of elements). - The execution time for the two different sorting algorithms. - The time complexity formulas for the two different sorting algorithms. Typical output:

Content preview

COS2611 ASSIGNMENT 2 2025
Ready solutions




Either copy this code OR download from the link at the end of the file


SPECIFICATIONS FOR THIS PROJECT
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) Utilize the implemented TWO sorting algorithms to sort these randomly generated arrays.

d) Generate a report to indicate:
- The input size (number of elements).

- The execution time for the two different sorting algorithms.

- The time complexity formulas for the two different sorting algorithms.

, Output:




Source Code:

//Your student number
//Your name


#include <iostream>
#include <vector>
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <cmath>
//#include "COS2611_As2_P1.h"
using namespace std;


//Function for the first sorting algorithm
// Bubble Sort implementation
void bubbleSort(vector<int>& arr) {
int n = arr.size();
// Traverse through all array elements

Document information

Uploaded on
July 21, 2025
Number of pages
7
Written in
2024/2025
Type
Other
Person
Unknown
R104,33

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CrystalIndigo
4,1
(53)
Sold
491
Followers
226
Items
73
Last sold
1 month ago

Reviews from verified buyers




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions