Exercises

9.1 Why is it that linked data structures cannot be copied to a disk and then later read from the disk and reinstalled? For instance, take a search tree and write each node to a disk. Then just read it back, and store it in the memory. Don't we get the same tree?

9.2 Write access functions that can retrieve or store a float value at any memory location without regard to memory alignment.

9.3 Write a program that compacts a structure (including an int array, a float , a double , and a char ) and then relativizes the segment where the structure is compacted. Write access functions that can access (store or retrieve) the relativized compacted form of the structure.

9.4 Write a program that creates a linked tree in which each node has an arbitrary number of children. Then write a function that uses the allocation from arena strategy to create the tree in a serialized way. Relativize the serialized tree, copy the segments somewhere else in the memory, absolutize the tree, and check that it is the same tree. You may modify the code presented in this chapter.

9.5 Modify the code from Exercise 9.4 for some other linked data structure.

9.6 Redo Exercise 9.4 to obtain a serialized version of the tree.

9.7 Redo Exercise 9.5 to obtain a serialized version of the data structure.

9.8 Using two arrays of size N , implement a serialized version of a doubly linked list of integers in the range 0..N-1 .



Memory as a Programming Concept in C and C++
Memory as a Programming Concept in C and C++
ISBN: 0521520436
EAN: 2147483647
Year: 2003
Pages: 64

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net