100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COS2611 assignment 2 project solution 2025

Rating
4,0
(1)
Sold
3
Pages
7
Uploaded on
21-07-2025
Written in
2024/2025

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:

Show more Read less









Whoops! We can’t load your doc right now. Try again or contact support.

Document information

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

Subjects

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

Reviews from verified buyers

Showing all reviews
4 months ago

4,0

1 reviews

5
0
4
1
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

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 University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
486
Member since
5 year
Number of followers
226
Documents
73
Last sold
2 months ago
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 reviews

5
27
4
13
3
6
2
1
1
4

Recently viewed by you

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

Frequently asked questions