{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Sampleexam2 - ECE242 Data Structures and Algorithms Fall...

This preview shows pages 1–4. Sign up to view the full content.

ECE242 Data Structures and Algorithms Fall 2008 2 nd Midterm Examination (120 Minutes, closed book) Name: ______________________ Student ID: ______________________ NOTE: Any questions on writing code must be answered in Java using data structures topics covered in lectures 1 - 26. Question Score 1 (10) 2 (20) 3 (25) 4 (10) 5 (15) 6 (20)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1. [10pt] Consider the below sequence of integers: 5 7 1 4 8 6 3 2 10 9 Show the steps involved when a merge sort algorithm is run on the above sequence of integers to sort them in ascending order (smallest value on the left). Note: You do not need to write any Java code, however, you need to show each step in the sorting process to receive full credit.
2. [20pt] a) [17pt] Consider two unsorted arrays, ArrayA and ArrayB that store Na and Nb non-repeating integers, respectively. Note that some of the integers in ArrayA could be present in ArrayB as well. Write a Java method mergeSortAB that merges ArrayA and ArrayB into a single sorted list, ArrayC , such that ArrayC contains integers that are in ArrayA or ArrayB but not in both. In other words, the ArrayC will not contain any duplicate elements.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern