0

我有 2 组排序的链表 A 和 B,我想得到 A * B 的乘积。对于 A,这很容易,因为它只是一个普通的嵌套 for 循环。乙呢?最初我想有 3 个嵌套的 for 循环,但由于我将使用指针,所以不可能使用 B[i][j]。有什么想法吗?

4

1 回答 1

0

我有点想办法做到这一点。

while (A != NULL)      //your first list
{                   
                       // store your row value and col in variables
   while (B != NULL)   // second list
   {
      if (colB == rowA) // you check if the b col is equals to a row, if yes you can
                        // start storing the values inside the 3rd link. 



    }

}
于 2013-02-17T16:07:10.763 回答