Answered Questions

  • Time Complexity of Adding Three Matrices

    What is the time complexity of adding three matrices of size NXN cell-by-cell?

    Manish Yadav

    • Oct 15th, 2011

    Time Complexity of Adding Three Matrices because there is only two loop are needed for adding the matrix so complexity will be o(n^2), there is no effect for increase the number of matrix. it will be same for n number of matrix.

    Code
    1. algo like this.......
    2.  
    3. for(i=0;i<n;i++)
    4. {
    5.  for(j=0;j<n;j++)
    6.  {
    7.    result[i][j]=a[i][j]+b[i][j]+c[i][j]+...........................z[i][j];
    8.  }
    9. }
    10.  

    sonia_mehta

    • Jul 6th, 2010

    Program looks like......for(i=0;i<n;i++){ for(j=0;j<n;j++) {   result[i][j]=a[i][j]+b[i][j]+c[i][j]; }}loop will execute n*n times...and 2 add operations..if 1 add op takes 'c' time, thentotal time= 2*c*n*nthus, time complexity= n*n......

  • Dynamic Inserting and Deleting

    Which data structure is used for inserting and deleting dynamically?

    stealth

    • Mar 2nd, 2010

    Dynamic insertion and deletion works well with Lists (like a doubly linked list)(also mentioned in the previous answer)The problem gets incremented this way;Insertion at a particular location; should ...