{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

H04 Midterm Practice

Here are some examples subtractbookkeeper keep

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: L if no occurrence was found. Here are some examples: Subtract("bookkeeper", "keep") Subtract("banana band", "ban") Subtract("same", "same") Subtract("computer", "comet") Subtract "booker" "ana band" "" NULL does not change its parameters, but returns a new dynamically-allocated string. char *Subtract(const char *outer, const char *inner) { Problem 2: Implementing and using generic interfaces ( The CVector stores a linear collection of values accessed by index. The CSparseVector is similar but the value for an index is empty until explicitly set, allowing efficient representation of a sparse collection by storing only the non-empty values. A C SparseVector is allocated with a specified max index and all values are initially empty. C SVSetNth sets the value at an index. The CSparseVector implementation is layered on a C Vector that stores the non-empty values. Each CVector entry is a "memory blob" of the value with its true index. If values are set only for indexes 8, 22, and 3, the underlying CVector would store three entries as shown here (the patterned regions are the client's values, the neighboring number is its index): 8 22 3 The CSparseVector is a generic interface that can store values of any type. The value size is specified when creating a new CSparseVector and all values are referred to by address when entering and retrieving them. You are to implement just one operation: void...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online