DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
No More Array Errors (Part II) - Array_alg(3C++)

An array-based implementation of Set(3C++)

Rather than spending any more time discussing abstract design philosophy, let's look at a concrete example: the implementation of a set class. Rather than specifying our own set operations, we will simply adopt the existing functional specification of Set(3C++). Whereas the current implementation of Set(3C++) uses a relatively complicated data structure, our implementation, which we call Array_set, uses a Block(3C++) as the underlying Array_set representation and Array_alg(3C++) to implement the Array_set operations. After choosing a representation and formalizing the representation invariant, we will look at several Array_set operations whose implementations are interesting from an Array Algorithms perspective.

As you follow the development, please have the relevant manpages handy. Be forewarned that, to help elucidate key points about Array Algorithms, we will be making some intentional false starts; in general, you should follow each discussion to its conclusion to discover the correct (or most efficient) implementation. A complete Array_set implementation can be found at the end of this tutorial.


Next topic: The Array_set representation
Previous topic: Using Block(3C++) with Array Algorithms

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004