After this class, you should be able to:
n
, and its actual running time s
for some input of size m
, derive its running time for a larger input size, as a function of s
.
n x n
matrices A and B, and store the result in a matrix C. The matrix product is defined by Cij = Sumk=0n-1 AikBkj
, for each i, j, 0 < i, j < n
. Determine the number of additions and multiplications performed by your algorithm, as a function of n
.
s
seconds on matrices of size n x n
, then how many seconds will it take on matrices of size 2n x 2n
?
s
seconds on matrices of size n x n
, then approximately how many seconds will it take on matrices of size 2n x 2n
, for large n?
t1(n) = 100 n + n2
and Algorithm2 takes time t2(n) = 10 n2
, then which algorithm will you use in an application where n
is typically less than 10
? Which algorithm will you use if your application typically had n
greater than 100?
Algorithm1: insert = n
operations, delete = log n
operation, lookup = 1
operation.
Algorithm2: insert = log n
operations, delete = log n
operation, lookup = log n
operation.
Note that insertion and deletion actually change the number of customers, but we will ignore that for the time being. Just assume that n
is some fixed, large number. Which algorithm will you use if the application had frequent insertions and deletions, and infrequent lookups? Which algorithm will you use if the application had infrequent insertions and deletions, and frequent lookups?
2n2 + 3n + 1 <4n2, n > 2
. (You may give us a hardcopy of your solution, if you wish to get feedback from us.)