|
||||||
| Programming Theory Discuss programming theory, algorithm efficiency, logic, and other any other category where math and computer science overlap. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
Saying a function is O(6x^2) and saying it is O(x^2) is saying the same thing. The constant multiplier is made irrelevant by the definition of O().
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||||
|
O() gives you a measure of algorithmic efficiency. If you have an algorithm that is O(x), it is fundamentally more efficient than O(x^2). The actual values for the algorithms may be 1000x+1000 vs x^2, but after a while, the x^2 version still becomes worse. Algorithms are usually measured in efficiency against memory usage or speed. They are also sometimes rated against average and worst-case efficiency (quicksort has different values).
If you analyze the efficiency of your code, it will generally help you determine where to start making changes and what can be left alone.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||||
|
As an example:
The algorithms for various containers/algorithms in the C++ STL have efficiencies as part of the standard. So, for instance, copying a deque is supposed to have linear ( O(x) ) efficiency. (kinda makes sense that it should take about as long as it has elements to copy, right?) Unfortunately, the analysis of whether a given implementation meets the a given efficiency is a bit... complicated. I read over the efficiency calculations for quicksort and heapsort a while back, and didn't fully understand them after a casual reading. A good book on data structures/algorithms will spend a LOT of time discussing how to calculate O() for a given algorithm.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pointers....or arrays | the_code_charmer | C and C++ | 4 | 01-16-2008 11:00 AM |
| Struct notation | kenna | C and C++ | 1 | 12-23-2007 12:55 PM |
| Big O notation | shinta | General Programming | 2 | 11-18-2007 10:36 AM |
| Variable Standards | Saint | General Programming | 5 | 05-14-2007 11:25 AM |
| 'BigOh' Notation | DansTransAM | General Programming | 3 | 09-14-2006 11:56 AM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| LogicKills | ........ | 20.00000 |
| sam | ........ | 20.00000 |
| gaylo565 | ........ | 18.00000 |
| |pH| | ........ | 15.00000 |
| WingedPanther | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 67%