efficient algorithm instead of looping

后端 未结 3 2158
深忆病人
深忆病人 2021-02-15 13:21

I have a data set where each samples has a structure similar to this

X=[ [[],[],[],[]], [[],[]] , [[],[],[]] ,[[][]]]

for example:



        
3条回答
  •  失恋的感觉
    2021-02-15 13:44

    There's nothing you can do here. You want to get the results of all multiplications, you just have to do them, and that's what your algorithm does. One of the only things you can do is store your results in a hashtable, in case you know that you have a lot of duplicate results, but it's gonna cost a lot of memory if you don't. By the way, multithreading might make your program run faster, but it will never improve it's complexity, which is the number of operations needed.

提交回复
热议问题