matrix multiplication algorithm time complexity

后端 未结 4 600
我寻月下人不归
我寻月下人不归 2020-12-05 07:13

I came up with this algorithm for matrix multiplication. I read somewhere that matrix multiplication has a time complexity of o(n^2). But I think my this algorithm will giv

4条回答
  •  感情败类
    2020-12-05 08:02

    The standard way of multiplying an m-by-n matrix by an n-by-p matrix has complexity O(mnp). If all of those are "n" to you, it's O(n^3), not O(n^2). EDIT: it will not be O(n^2) in the general case. But there are faster algorithms for particular types of matrices -- if you know more you may be able to do better.

提交回复
热议问题