Exercises and Discussion Topics
-
Select a large software system, locate where arrays are used,
and categorize their uses.
-
Fixed-length arrays notoriously impose arbitrary limits to
program elements.
Locate 20 instances of such limits in existing code and check whether
these are documented in the respective system's documentation.
-
For the RDBMS of your choice locate documentation regarding cursors.
Compare the functionality offered by cursors to the functionality offered
by pointers to structures.
-
A number of linear algebra and matrix libraries are available on the Web
in open-source form.
Download two such packages and identify how matrices are stored.
-
Examine the stack operations performed on implementations based on
explicit code.
Identify those operations that do not fit into the model we described.
Propose function names and code for implementing them.
-
Locate code where explicit control structures can be substituted
by an array lookup mechanism.
Explain how the code would be implemented.
-
Do you envisage any difficulties in implementing a hash-based map as an
abstract data type?
Suggest a way to overcome them.
-
Locate instances in the course's reference source code where sets
are being used.
Suggest other implementation strategies for each particular
problem.
Comment on whether a set data-type is used partly, because
it is easy to create an efficient implementation for it.
-
Locate five instances of singly and doubly-linked lists in the
course's reference source code and explain the function they perform.
-
Draw a binary tree containing the host names in your email
address book.
Add the names in a random order; not alphabetically.
Systematically walk through the tree to derive a sorted
listing of the host names.
Construct a new tree adding the host names in the order they
appear in the listing you constructed.
Comment on the efficiency of searching data in the two trees.