• 0

Using Big Oh Notation


Question

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

  • 0

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

  • 0

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.