Final Exam Data Structures and Algorithms
Final Exam Data Structures and Algorithms
Name: __________________________________
Course and Year: _______________________ Date _________
I. Algorithm Programming (Sets) Part 1. Create a program for the different set 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. Set A (1, 2, 3, 4, 5, 6) – Set B (4, 5, 6, 7, 8) Create a program that outputs the union of set A and set B.
2. Set A (2, 4, 6, 8, 10) – Set B (1, 3, 5, 7, 9) Create a program that outputs the union of set A and set B.
3. Set A (22, 21, 23, 25, 27) – Set B (21, 22, 23, 24, 25) Create a program that outputs the difference of set A and set B.
4. Set A (10, 11, 12, 13, 14, 15) – Set B (10, 12, 14, 16) Create a program that outputs the intersection of set A and set B.
5. Set A (1, 2, 3, 4, 5, 6, 7) – Set B (21, 22, 23, 24, 25, 26) Create a program that outputs the union of set A and set B.
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 the array below. Create a program that prints the even numbers from the array of numbers only.
Array:
1 2 3 4 5 6 7 8 9 10
2. Suppose we have the array below. Create a program that prints the average of the array of numbers below.
Array:
75 76 89 90 95 85 75 75 90 93
Algorithm Programming (Sorting) Part 3. Create the sorting 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. 16, 55, 21, 45, 54, 75, 90, 101, 26 – BUBBLE SORT in ASCENDING ORDER
2. 17, 21, 19, 20, 1, 35, 9, 25, 25, 16 – SELECTION SORT in DESCENDING ORDER
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 the dataset below. Create a program that uses the BINARY SEARCH algorithm. The program should
search for the number 40 in the current dataset. If the data is present the program should output “PRESENT” and if the data
is not present, the program should output “NOT PRESENT”.
1 2 3 4 5 6 7 8 9 10 11 12 25 26 27 28 29 37 3 39 40 41 42
8
Algorithm Programming (Linked Lists) Part 5. 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. Create the indicated SINGLY LINKED LIST below. The program should output all of the data from the linked list.
Algorithm Programming (Binary Trees) Part 6. 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. Create a BINARY TREE for the data set below. The program should output all of the nodes of the BINARY TREE.
3 2
4 5 6
Approved: