Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Overig

COS2611 assignment 2 project solution 2025

Beoordeling
4,0
(1)
Verkocht
3
Pagina's
7
Geüpload op
21-07-2025
Geschreven 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:

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

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

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
21 juli 2025
Aantal pagina's
7
Geschreven in
2024/2025
Type
OVERIG
Persoon
Onbekend

Onderwerpen

€5,45
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Beoordelingen van geverifieerde kopers

Alle reviews worden weergegeven
8 maanden geleden

4,0

1 beoordelingen

5
0
4
1
3
0
2
0
1
0
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
CrystalIndigo University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
486
Lid sinds
5 jaar
Aantal volgers
226
Documenten
73
Laatst verkocht
5 maanden geleden
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 beoordelingen

5
27
4
13
3
6
2
1
1
4

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen