I was reading "Programming Pearls" and I am really confused in one of the solution explanations--problem 9 in column 1.
The question was: When using bitmap data to represent a set of integers, the first phase initializes the set to empty. But initializing the space can itself take a great deal of time. Show how to circumvent this problem by designing a technique to initialize an entry of a vector to zero the first time it is accessed.
The answer was : The effect of initializing the vector data[0...n-1] can be accomplished with a signature contained in two additional n-element vectors, from and to, and an integer top. If the element data[i] has been initialized, then from[i] < top and to[*from*[i]] = i. Thus from is a simple signature, and to and top together make sure that from is not accidentally signed by the random contents of memory.
I have read this answer several times. I don't understand it.
Can someone explain it?
Thanks,