Data Str & Algorithm HW Solutions 64

Data Str & Algorithm HW Solutions 64 - block hold b...

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

View Full Document Right Arrow Icon
10 Indexing 10.1 (a) A record in the linear index refers to a block of sorted data records. Assuming that the linear index stores a key and a 4 byte block number, the index can hold information for 32K blocks, for a total f le size of 32MB, or 4M records. (b) This second level index allows the f rst level index to be 128 blocks, or 16K records long. Thus, the record f le can contain 16K blocks, or 16MB, which is 2M records. While this is smaller than the situation in (a), there is only a very small amount of main memory in use. 10.2 (a) Assuming that the linear index stores a key and a 4 byte block num- ber, the index can hold information for 256K blocks. Assume that a
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: block hold b 4096 / 68 c = 60 records. Thus, the data f le can hold up to 15,728,640 records. (b) This second level index allows the f rst level index to be 1024 blocks, or .5M records long. Thus, the record f le can contain .5M blocks, which is 30M records. 10.3 No change needs to be made, since the data value itself is not used by the binary search function, only the key which is stored in the index. 10.4 The linear index will store the key values in sorted order, with each key having a pointer to its string. 10.5 (a) sec primary key index index key DEER 2398 DUCK 4 1 3456 FROG 7 2 8133 GOAT 9 3 9737 64...
View Full Document

Ask a homework question - tutors are online