I am studying performance analysis and character instance gets brought up a lot. I am unclear to what this means. It also talks about functions of instance characteristics. Can someone elaborate?
- 2 Contributors
- forum1 Reply
- 30 Views
- 6 Years Discussion Span
- comment Latest Post by vijayan121
vijayan121 1,152
Let us say we have a function:
// return a string with all occurrences of substr in str replaced with replacement
std::string replace_all( const std::string& str, const std::string& substr,
const std::string& replacement ) ;
This function can be called with many different input sets (each set being a tuple of three strings). A specific invocation of the function with a given input set is an instance. To analyuse its time and space complexity, we need to consider what happens as the size of data increases - what are the characteristics of the input data set which will affect performance? An instance characteristic is a (typically numeric) measure of the proiperties of the input data that has a bearing on performance.
In the above example, the instance characteristics would be
N - the length of str
K - the length of substr
L - the length of replacement
We would aim to estimate performance of the function as time(N,K,L) or space(N,K,L)