You are on page 1of 14

NAME:AYINDE PRECIOUS OOREOLUWA

MATRIC NUMBER:BU19CIT1041
DEPARTMENT:COMPUTER SCIENCE
.

1.Code each of the 4 algorithms (A to D) in C++


and
test with 2 sets of data for each run and each
algorithm. Pls try to note the processing time
for
each program

Due date: 3rd Dec 2020; submit to
ekostudents@gmail.com the following:

Source code for each program

Test data for each program

Generated output for program

Processing/execution time for each program
Which algorithm is better?

A.The input is a sequence of integers stored in


array.
Output the minimum.
I) Source code of the program
II)Test data and output for the program

TEST DATA:{45,60,78,56,40}
EXECUTION TIME:26.89 SECONDS

OUTPUT
TEST DATA 2:{3,5,89,56,79,23,45,5,65}
EXECUTION TIME:44.85 SECONDS

OUTPUT:

2. This algorithm uses two temporary arrays

A.Source code of the program


II)Test data and output for the program

Test data 1:{34,6,5,9,20,8,11,7};


EXECUTION TIME:0.1934 SECONDS
Test data 2:{56,78,9,7,8,9,6,5}
EXECUTION TIME:0.266 SECONDS
OUTPUT:
3.Sort the input in increasing order. Return the
first element of the sorted data.

I. )Source code of the program


II)Test data and output for the program

Test data 1:{34,6,5,9,20,8,11,7};


EXECUTION TIME:0.1878 SECONDS
OUTPUT:
Test data 2:{56,78,9,7,8,9,6,5}
EXECUTION TIME:0.2446 SECONDS

OUTPUT:
4.)For each element, test
whether it is the minimum.

I.)SOURCE CODE
II.)Test data 1:{34,6,5,9,20,8,11,7};
EXECUTION TIME:0.2501 SECONDS
OUTPUT:

TEST DATA 2:{56,78,9,7,8,9,6,5}


EXECUTION TIME:0.2357 SECONDS
OUTPUT:

You might also like