Thread: algorithm analysis help

  1. #1
    Registered User
    Join Date
    Nov 2010

    algorithm analysis help

    the site doesnt let me post my question although I use code tags

    please read here

    hi guys i have this exercise and I m not sure if I'm correct [CODE]for (i=0 -


    hi guys

    <<< Copy/Pasted by mod >>>
    i have this exercise and I m not sure if I'm correct
    for (i=0;i<=n-2;i++){
         for(j = i+1; j<= n-1; j++){
               if (A[i,j] != A[j,i])
                     return false;
    a. What does this algorithm compute?
    b. What is its basic operation?
    c. How many times is the basic operation executed?
    d. What is the efficiency class of this algorithm?
    e. Suggest an improvement or a better algorithm altogether and indicate its efficiency class. If you cannot do it, try to prove that in fact it cannot be done.

    a. it checks to see if the array is symmetrical
    b. the if operation
    d. O(n^2), can this be Θ(n^2)?
    e. i dont think we can, since we have to check all the arrays elements to see if they match
    Last edited by Salem; 06-01-2011 at 10:07 AM. Reason: Seems easy enough to paste..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beam or Frame Analysis for Structural Analysis
    By greenmania in forum C Programming
    Replies: 3
    Last Post: 05-05-2010, 05:40 PM
  2. Code Analysis
    By guesst in forum C++ Programming
    Replies: 8
    Last Post: 09-09-2008, 04:17 PM
  3. Audio Analysis
    By d_henson in forum Tech Board
    Replies: 5
    Last Post: 03-13-2004, 03:59 PM
  4. Big-O analysis
    By Unregistered in forum C++ Programming
    Replies: 6
    Last Post: 06-26-2002, 01:21 PM