Data Str & Algorithm HW Solutions 56

Data Str & Algorithm HW Solutions 56 - 56 Chap. 8...

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

View Full Document Right Arrow Icon
56 Chap. 8 File Processing and External Sorting 1 n 2 ( 2 n 3 +3 n 2 + n 6 + 3 n 2 +3 n 6 )= 2 n 3 +6 n 2 +4 n 6 n 2 n/ 3 . 8.7 The batch method is more ef f cient when enough sectors are visited to make processing the whole f le in sequential order more ef f cient. Since the f le consists of 10,000 sectors, it requires 50,000 ms to process sequentially. This is equivalent to random access to 1000 sectors. Thus, if the set of queries requires processing more than 1000 sectors, it would be more ef f cient to process the entire f le in batch mode. 8.8 (a) 104685 (b) 5 (6 times) 3 (3 times) 4 (1 time) 6 (1 time) 8 (1 time) (c) 5 (6 times) 3 (3 times) 9 (3 times) 2 (3 times) 8 (2 times) (d) 586410 8.9 Since working memory is 1MB and the block size is 1KB, the number of blocks in working memory is 1024. The expected runlength is 2MB, since replacement selection will, on average, produce runs that are twice the mem- ory size. 1024 runs can be merged in a single multiway merge operation.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course MAP 2302 taught by Professor Bell,d during the Fall '08 term at UNF.

Ask a homework question - tutors are online