Just need a confirmation on something real quick.
If an algorithm takes n(n-1)/2 tests to run, is the big oh O(n^2)?
Just need a confirmation on something real quick. If an algorithm takes n(n-1)/2 tests
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
n(n-1)/2 expands to
(n^2 -n) / 2, that is(n^2/2) - (n/2)(n^2/2)and(n/2)are the two functions components, of whichn^2/2dominates.Therefore, we can ignore the
- (n/2)part.From
n^2/2you can safely remove the /2 part in asymptotic notation analysis.This simplifies to
n^2Therefore yes, it is in O(n^2)