How does Lowe compute the "repeatability" of his SIFT Algorithm?

What are steps to compute algorithm complexity?

  • I have forgotten stuff on how to compute time complexities of algorithms. I am not looking for a Book or 30 page blog to refresh that knowledge. Taking this below algorithm could you please correct in the way i compute the Time Complexity. Thanks Linear Searchbool SeqSearch(int[] arr, int sValue) {     for (int index = 0; index < arr.Length-1; index++)     if (arr[index] == sValue)         return true;     return false; } Steps and Logic used Loop through all elements - N Comparison for each index - 1 or is it N Return true or false - 1 Finally I forgot do we add these up or do we multiply them? I assumed we had to add so ended up with N+N+1 so this must be a Big Oh! of N. O(N) Questions Do i multiply the time taken for each steps or add them up For a comparison it is not possible to determine when it will end. So what is time taken ( i assumed 1 because it may be found at first index, N otherwise as last index) Assignments and Return are constant time 1 ? note: Do not refer me to a website. Quora will stay long and people who have the same/similar question will certainly find the answer to this post useful. I can't trust when the other website will be down

  • Answer:

    In the example you gave, the "step" we would consider would be "arr[index] == sValue" and it is repeated array length - 1 times. If array length is n, it is in the order of O(n-1) which is same as O(n). Basically, we consider a "step" that is the most time-consuming, recurring in our algorithm and see how many times we are executing that. The step we select for one algorithm might be different from the step we choose for another. That is the reason why we go for asymptotic measures of these steps (when the input size reaches infinity). When we are talking in asymptotic terms, O(n) and O(n+1) are so close that we say they are the same. But they are not same as O(N^2) as regardless of time taken by the steps we considered (n,N), when n,N reach infinity, O(n^2) will be greater than O(N). You will get a very good understanding on how the asymptotic notations work from this "8" (not 30) page pdf :) http://classes.soe.ucsc.edu/cmps102/Spring04/TantaloAsymp.pdf

Naga Krishna Teja Komma at Quora Visit the source

Was this solution helpful to you?

Other answers

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.