Consider the definition-based algorithm for adding two n × n matrices.
a. what is its basic operation?
b. how many times is it performed as a function of the matrix order n?
c. as a function of the total number of elements in the input matrices?
Answers
Answered by
4
For any argumentn, the constant functionf(n) assigns the valueC. It doesn't matter what the input sizenis,f(n) will always be equal to the constant valueC. The most fundamental constant function isf(n) = 1, and this is the typical constant function that is used in the book.The constant function is useful in algorithm analysis, because it characterizes the number of steps needed to do a basic operation on a computer, like adding two numbers, assigning a value to some variable, or comparing two numbers. Executing one instruction a fixed number of times also needs constant time only.
Similar questions
English,
7 months ago
English,
7 months ago
Social Sciences,
7 months ago
Social Sciences,
1 year ago
Math,
1 year ago
Biology,
1 year ago
English,
1 year ago
Sociology,
1 year ago