Originally posted by zeitghost
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: Big O notation.
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Big O notation."
Collapse
-
-
Originally posted by OwlHoot View Postbecause the product of two numbers is at most the square of the largest.
The light goes on!!!!!
Owlhoot - you've always been my favourite
Originally posted by OwlHoot View PostP.S. What does "get a word" mean?
many many thanks, and to everyone else too x x x
Leave a comment:
-
Originally posted by SallyAnne View PostThanks all of you.
Can I ask then....if you're multiplying 2 numbers...
why is it O(n^2) and not O(n*m)?
Does it not matter that the 2 numbers which we're multiplying are not the same? Does n simply mean "input"?
BTW, you can multiply two numbers of size n (upper bound on both) in O(n.log(n)) by using a fast Fourier transform
P.S. What does "get a word" mean?
Leave a comment:
-
Originally posted by SallyAnne View Postwhat it's for, and why we would use it etc.
Like, what is ^ ?? I've never seen that symbol used before, so I dont get how it relates to the multiplication answer. I really dont understand O(n^2) at all
Leave a comment:
-
Originally posted by SallyAnne View PostThanks all of you.
Can I ask then....if you're multiplying 2 numbers...
why is it O(n^2) and not O(n*m)?
Does it not matter that the 2 numbers which we're multiplying are not the same? Does n simply mean "input"?
n^m is n to the power of m, not n*m.
If I understand it correctly you use different powers of n based on the format of the data you are using.
Leave a comment:
-
It's all about functions right?
So imagine you are at this do. It takes ten minutes to get to the bar and back forra round. So yous have to calcumerlate the optimum time taken for the dregs because yous dont want to be sitting there dry, do you?
If yous get to the bottom of the glass, it's 'oh ffs'. If everyone gets there is 'OH ffs' - thats the big O.
Next week - Algo-Rythm and Computational-Complexity(checking yer change)
Leave a comment:
-
Thanks all of you.
Can I ask then....if you're multiplying 2 numbers...
why is it O(n^2) and not O(n*m)?
Does it not matter that the 2 numbers which we're multiplying are not the same? Does n simply mean "input"?
Leave a comment:
-
An easy way to understand what O(n), O(n^2) mean is to imagine you are doing something with an array of n elements.
If you simply want to add all the values in an array, you need to look at each one once. If you double the number of elements you double the amount of items to look at.
If you want to sum elements in an NxN 2D array, you have to look at n^2 elements. If you double n, the number of elements is increased by 4.
It gets more complicated when we get into O(log(n)) but simple examples explain the point (I hope).
In designing an algorithm, knowing the what O it has is important... if you are testing on a small dataset of 100 elements, and then in real life run it on 10000 elements, O(n) will be 100 times slower... but O(n^2) will run 10,000 times slower.
Leave a comment:
-
Originally posted by OwlHoot View PostThere's a Wikipedia article here.
Writing f(x) = O(log(x)) for example just means that for sufficiently large x, |f(x)| is less than C.log(x) for some constant C.
Likewise, if f(x) is a polynomial, say x^n + .. + x + 5 then f(x) = O(x^n), because for sufficiently large x the leading term (with the highest power) dominates all the others however large their coefficients, and this argument can easily be formalized:
|a_n.x^n + .. + a_1.x + a_0| <=
<= |a_n.x^n| + .. + |a_1.x| + |a_0|
<= |a.x^n| + .. + |a.x| + |a| where |a| = max(|a_i|)
= |a| . (|x^n| + .. + |x| + 1)
<= |a| . (|x^n| + .. + |x^n| + |x^n|)
= (n+1) . |a| . |x^n|
So the constant C can be taken as (n + 1).|a|
Have a word man!!!!!
Leave a comment:
-
x^2 means x squared. It's used online a lot because superscript is a pain in the arse.
Leave a comment:
-
Originally posted by SallyAnne View PostThanks Timber....
I have grasped the theory of it - what it's for, and why we would use it etc.
And I get that for all arithmetic operations, the size of the input will be the number of digits in the input numbers. That makes sense to me.
What I struggle with is the mathsy stuff.
Like, what is ^ ?? I've never seen that symbol used before, so I dont get how it relates to the multiplication answer.
I really dont understand O(n^2) at all
I will award you with one free "SallyAnne will concede in an argument" token if you can help me any further
Leave a comment:
-
Originally posted by SallyAnne View PostThanks Timber....
I have grasped the theory of it - what it's for, and why we would use it etc.
And I get that for all arithmetic operations, the size of the input will be the number of digits in the input numbers. That makes sense to me.
What I struggle with is the mathsy stuff.
Like, what is ^ ?? I've never seen that symbol used before, so I dont get how it relates to the multiplication answer.
I really dont understand O(n^2) at all
I will award you with one free "SallyAnne will concede in an argument" token if you can help me any further
For example
2^3 is 2 to the power of three, or 2*2*2
Leave a comment:
-
Originally posted by TimberWolf View PostAddition would be O(n) because the the problem only gets slower in direct proportion to the number of bits/bytes being added, and multiplication could be as high as O(n^2). The latter (quadratic time) not being too bad, at least compared to exponential functions, but not as fast as linear or constant time algorithms.
I have grasped the theory of it - what it's for, and why we would use it etc.
And I get that for all arithmetic operations, the size of the input will be the number of digits in the input numbers. That makes sense to me.
What I struggle with is the mathsy stuff.
Like, what is ^ ?? I've never seen that symbol used before, so I dont get how it relates to the multiplication answer.
I really dont understand O(n^2) at all
I will award you with one free "SallyAnne will concede in an argument" token if you can help me any further
Leave a comment:
-
There's a Wikipedia article here.
Writing f(x) = O(log(x)) for example just means that for sufficiently large x, |f(x)| is less than C.log(x) for some constant C.
Likewise, if f(x) is a polynomial, say x^n + .. + x + 5 then f(x) = O(x^n), because for sufficiently large x the leading term (with the highest power) dominates all the others however large their coefficients, and this argument can easily be formalized:
|a_n.x^n + .. + a_1.x + a_0| <=
<= |a_n.x^n| + .. + |a_1.x| + |a_0|
<= |a.x^n| + .. + |a.x| + |a| where |a| = max(|a_i|)
= |a| . (|x^n| + .. + |x| + 1)
<= |a| . (|x^n| + .. + |x^n| + |x^n|)
= (n+1) . |a| . |x^n|
So the constant C can be taken as (n + 1).|a|
Leave a comment:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Is an unpaid umbrella company required to pay contractors? Yesterday 09:28
- The truth of umbrella company regulation is being misconstrued Nov 25 09:23
- Labour’s plan to regulate umbrella companies: a closer look Nov 21 09:24
- When HMRC misses an FTT deadline but still wins another CJRS case Nov 20 09:20
- How 15% employer NICs will sting the umbrella company market Nov 19 09:16
- Contracting Awards 2024 hails 19 firms as best of the best Nov 18 09:13
- How to answer at interview, ‘What’s your greatest weakness?’ Nov 14 09:59
- Business Asset Disposal Relief changes in April 2025: Q&A Nov 13 09:37
- How debt transfer rules will hit umbrella companies in 2026 Nov 12 09:28
- IT contractor demand floundering despite Autumn Budget 2024 Nov 11 09:30
Leave a comment: