1
Name:_______________________
Covers
50 min
CSCI 3230 Data Structures and Algorithms
Georgia Southern University (Armstrong)
Instructor: Dr. Y. Daniel Liang
I pledge by honor that I will not discuss this exam with anyone until my
instructor reviews the exam in the class.
Signed by ___________________ Date ___________________
1. (3 pts)
Suppose you need to store a list of elements, if the number
of elements in the program is fixed, what data structure
should you use? (array, ArrayList, or LinkedList)
If you have to add or delete the elements at the beginning
2. (3 pts) Show the BST after inserting 35, 85 and 103.
60
root
2
3. (3 pts) Show the BST after deleting 15 from the
following BST.
60
root
4. (3 pts) Show the BST after deleting 60 from the
following BST.
60
root
5. (6 pts) Show the inorder, preorder, and postorder of the
following BST.
3
60
root
6. (2 pts) Given the following heap, show the resulting
heap after adding 63 to the heap.
62
7. (2 pts) Given the following heap, show the resulting
heap after removing 62 from the heap.
62
4
8. (8 pts) Add a void instance method replaceAll(E oldE, E newE) in the MyLinkedList
class to replace the occurrence of all oldE value with the specified newE value.
Implement this method in O(n) time.
9. (8 pts) Add an instance method max() in the BST class to return the largest element in
this tree. Returns null if it does not exist.