Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
COLLEGE OF INDUSTRIAL TECHNOLOGY
MIDTERM EXAMINATION
DATA STRUCTURES AND ALGORITHMS
2ND Semester, A.Y. 2020 - 2021
Name ________________________ Score ________
Course and Year ________________ Date _________
I. Algorithm Programming (Sorting) Part 1. Create a program for the different sorting algorithms indicated below. (5 points
each)
Rubrics:
10 points – there are no errors in the algorithm created.
7 points – there are 1 – 2 errors in the algorithm created.
5 points – there are 3 – 5 errors in the algorithm created.
3 points – there are 5 – 7 errors in the algorithm created.
1 point - the program is runnable but there are no clear traces of the algorithms used to solve the problems
0 points – there is no visible algorithm created
1. 3, 65, 72, 38, 70 – Bubble Sort in DESCENDING ORDER
2. 23, 69, 7, 31, 51 – Insertion Sort in ASCENDING ORDER
3. 99, 79, 5, 35, 33 – Selection Sort in ASCENDING ORDER
4. 14, 64, 69, 62, 67 – Bubble Sort in ASCENDING ORDER
5. 20, 21, 55, 71, 19 – Selection Sort in DESCENDING ORDER
Algorithm Programming (Arrays and Array Traversal) Part 2. Create the algorithms indicated below. (10 points each)
Rubrics:
10 points – there are no errors in the algorithm created.
7 points – there are 1 – 2 errors in the algorithm created.
5 points – there are 3 – 5 errors in the algorithm created.
3 points – there are 5 – 7 errors in the algorithm created.
1 point - the program is runnable but there are no clear traces of the algorithms used to solve the problems
0 points – there is no visible algorithm created
1. Suppose we have a multi-dimensional (2d)array. Create an algorithm which prints all of the values of the (2d)multi-
dimensional array and it should also print the average of all of the integer values of the multi-dimensional array. The multi-
dimensional (2d)array values are:
87 89 45 77 90 65
75 75 88 81 82 84
85 85 90 99 90 95
91 40 82 83 83 86
78 48 98 65 75 48
48 65 32 15 25 24
15 95 87 56 45 44
35 32 33 35 15 80
2. Suppose we have a multi-dimensional (2d)array. Create an algorithm which prints all of the Even and Odd numbers of the
array separately. The multi-dimensional (2d)array values are:
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
37 38 39 40 41 42
43 44 45 46 47 48
Algorithm Programming (Stacks and Queues) Part 3. Create the algorithms indicated below. (10 points each).
Rubrics:
10 points – there are no errors in the algorithm created.
7 points – there are 1 – 2 errors in the algorithm created.
5 points – there are 3 – 5 errors in the algorithm created.
3 points – there are 5 – 7 errors in the algorithm created.
1 point - the program is runnable but there are no clear traces of the algorithms used to solve the problems
0 points – there is no visible algorithm created
1. Suppose we have the string “MyHeroAcademia”. Use a Stack to reverse the order of the string.
Algorithm Programming (Searching) Part 4. Create the algorithms indicated below. (10 points each).
Rubrics:
10 points – there are no errors in the algorithm created.
7 points – there are 1 – 2 errors in the algorithm created.
5 points – there are 3 – 5 errors in the algorithm created.
3 points – there are 5 – 7 errors in the algorithm created.
1 point - the program is runnable but there are no clear traces of the algorithms used to solve the problems
0 points – there is no visible algorithm created
1. Suppose we have a data set of a multi-dimensional (2d)array. Create a program which uses Linear or Sequential Searching
to search for numbers in the data set. The program should ask the user what number to search for in the data set. If the data
is present, it should show the index as well as the number in the data set. If the data is not present in the data set, it
should print out “The Data is not present in the current Data Set”. The Data set values are:
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
37 38 39 40 41 42
43 44 45 46 47 48
2. Suppose we have a data set of a multi-dimensional (2d)array. Create a program which uses Binary Searching techniques to
search for numbers in the data set. The program should ask the user what number to search for in the data set. If the data
is present, it should show the index as well as the number in the data set. If the data is not present in the data set, it
should print out “The Data is not present in the current Data Set”. The Data set values are:
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
37 38 39 40 41 42
43 44 45 46 47 48
Prepared by: Reviewed by:
JEREMY MOSES T. EBREO IREL V. DERIJE
Instructor Department Chair, BS Computer Science
Approved:
EVANGELINE H. CASTRO, PhD
Dean, College of Industrial Technology