Winston Posted August 30, 2004 Share Posted August 30, 2004 Guy's can anyone explain it to me, i'm a little lost with it, lost with all the terms of O(1), O(n), and wtf is llog (N), i don't get how you use these to determine the scalability and run-time cost of the application. Thanks Link to comment Share on other sites More sharing options...
0 Starcom826 Posted August 30, 2004 Share Posted August 30, 2004 It's a notation to describe code speed basically. O(1) is instant. O(n) varies by the number of elements you are scanning. log is logarithmic. Link to comment Share on other sites More sharing options...
0 HeartsOfWar Posted August 30, 2004 Share Posted August 30, 2004 O(1) usually means the algorithm requires one pass to complete the task - (read or write a line to a file is usually O(1)) O(n) usually mean the algorithm requires n passes (Where n is the total number of elements in an array or list) - (FOR loops are O(n)) O(n^2) usually means the algorithm requiers n squared passes (Where n is the total number of elements in an array or list) - (Bubble sort is O(n^2), due to having two FOR loops) O(log) usually means the algorithm is logarithmic and will increase or decrease exponentially(See mathematical logorithms for more details) - (Binary tree, quick sort, etc is usually O(Log) As you can guess, having O(1) or O(log) is more desirable, because this means the algorithm will process the data faster... A simple test would be to have an unsorted list of 500 integers, then sort the list with a bubble sort.. (Notice how long it takes)... Now sort the list with a quick sort..., You will notice the quick sort is faster... Link to comment Share on other sites More sharing options...
0 Winston Posted September 1, 2004 Author Share Posted September 1, 2004 hmmm this sounds confusing haha, ok O(1) what does it mean basically, like why the 1? why not O(2) and i mean how exactly do uno if it is O(1), is there a listing of all the O(whatever) listing, and what each one is used for in each case. Link to comment Share on other sites More sharing options...
0 Andareed Posted September 1, 2004 Share Posted September 1, 2004 With order notation you can 'throw away' constants. So O(3*n + 2) is the same as O(n) and O(2) is the same as O(1). Link to comment Share on other sites More sharing options...
Question
Winston
Guy's can anyone explain it to me, i'm a little lost with it, lost with all the terms of O(1), O(n), and wtf is llog (N), i don't get how you use these to determine the scalability and run-time cost of the application.
Thanks
Link to comment
Share on other sites
4 answers to this question
Recommended Posts