COP5536-Exam1-solution

3 if you compute correctly that that the run size

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: (5 Points) b) The run size generated by simple internal sorting is the size of the memory, which is 1400 records. The average run size generated by the loser tree method is 2*loser‐tree‐size, which is 1200 records. Since larger run size will lead to better performance in external sorting, simple internal sorting approach will be more efficient given factor of run size in this case. (5 Points) Grading Criteria: 1) If you are comparing the run size of the two methods, you get 3 points for answering in the correct direction since the first sentence of the question reads “In the first phase of external sorting, we want to generate runs that are as long as possible. ”. 2) If you are comparing the run‐time or comparisons needed or other aspects of the two methods, you can get up to 3 points if your reason is acceptable. 3) If you compute correctly that that the run size generated by the loser tree method is 1200 records, then you get 1 more point. 4) If you compute correctly that the run size generated by simple internal sorting method is 1400 records, then you get 1 more point. 5) If you don’t write anything, you get 0 point. Question 4 a) (6 points) N = 2k (proof by induction) b) (8 points) 37‐‐‐‐‐‐‐‐‐‐‐10‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 1 | / \ / | | \ 41 28 13 6 16 12 25 | / / \ / \ | 77 8 14 29 26 23 18 / | | | 11 27 38 42 | 17 37‐‐‐‐‐‐‐‐‐‐‐10 1 | / \ / | | \ 41 28 13 6 16 12 25 | / / \ / \ | 77 8 14 29 26 23 18 / | | | 11 27 38 42 37‐‐‐‐‐‐‐10 25‐‐‐‐12‐‐‐‐‐‐‐‐‐‐16‐‐‐‐‐‐‐‐‐‐‐‐‐ 6 | / \ | / \ / / \ 41 28 13 18 26 23 8 14 29 | | / \ | 77 42 11 27 38 25 ‐‐‐‐‐‐‐‐ ‐‐12‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 6 / | / / / \ 37 18 10 8 14 29 | / / | / | | 41 16 28 13 11 17 38 / | | | 26 33 77 27...
View Full Document

Ask a homework question - tutors are online