Click here to Skip to main content
15,895,656 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Big Oh Computation Pin
Jason Lepack (LeppyR64)12-Aug-08 8:35
Jason Lepack (LeppyR64)12-Aug-08 8:35 
GeneralRe: Big Oh Computation Pin
Ian Uy12-Aug-08 8:40
Ian Uy12-Aug-08 8:40 
GeneralRe: Big Oh Computation Pin
Jason Lepack (LeppyR64)12-Aug-08 8:42
Jason Lepack (LeppyR64)12-Aug-08 8:42 
GeneralRe: Big Oh Computation Pin
Ian Uy12-Aug-08 8:52
Ian Uy12-Aug-08 8:52 
GeneralRe: Big Oh Computation Pin
Jason Lepack (LeppyR64)12-Aug-08 8:55
Jason Lepack (LeppyR64)12-Aug-08 8:55 
GeneralRe: Big Oh Computation Pin
Ian Uy12-Aug-08 8:57
Ian Uy12-Aug-08 8:57 
GeneralRe: Big Oh Computation Pin
Jason Lepack (LeppyR64)12-Aug-08 9:01
Jason Lepack (LeppyR64)12-Aug-08 9:01 
GeneralRe: Big Oh Computation Pin
supercat912-Aug-08 10:06
supercat912-Aug-08 10:06 
leppyr64 wrote:
When you nest loops you multiply the complexity.


If the number of iterations on an inner loop is proportional to the size of the problem, and will be the same for all iterations of the outer loop, then the complexity of the outer loop is a factor of N greater than that of the inner loop. The same will be true if the number of iterations for the inner loop will be uniformly distributed over a range, the top of which is proportional to the size of the problem.

There will be occasions, however, where nested loops aren't nearly as bad as they appear because, while the worst-case time of the inner loops is proportional to the size of the problem, they will almost always execute much faster. In Shell Sort, for example, there are three nested loops. In the last iteration of the outer loop, the middle loop will execute N-1 times and the inner loop may (worst-case) execute O(N) times, but the worst-case time is far less than O(N^2).
GeneralRe: Big Oh Computation Pin
Ian Uy12-Aug-08 16:24
Ian Uy12-Aug-08 16:24 
GeneralRe: Big Oh Computation Pin
Mark Churchill12-Aug-08 20:35
Mark Churchill12-Aug-08 20:35 
GeneralRe: Big Oh Computation Pin
Ian Uy13-Aug-08 2:49
Ian Uy13-Aug-08 2:49 
AnswerRe: Big Oh Computation Pin
Ian Uy15-Aug-08 6:56
Ian Uy15-Aug-08 6:56 
GeneralRe: Big Oh Computation Pin
Member 419459316-Aug-08 3:20
Member 419459316-Aug-08 3:20 
GeneralRe: Big Oh Computation Pin
Mark Churchill17-Aug-08 15:18
Mark Churchill17-Aug-08 15:18 
GeneralRe: Big Oh Computation Pin
Ian Uy17-Aug-08 19:29
Ian Uy17-Aug-08 19:29 
GeneralRe: Big Oh Computation Pin
Mark Churchill17-Aug-08 19:33
Mark Churchill17-Aug-08 19:33 
AnswerRe: Big Oh Computation Pin
sableng22-Aug-08 10:04
sableng22-Aug-08 10:04 
Questionde-Compress algorith Pin
Howard Richards11-Aug-08 22:57
Howard Richards11-Aug-08 22:57 
QuestionPatterns for data sorting/grouping in memory Pin
petrveit5-Aug-08 4:15
petrveit5-Aug-08 4:15 
AnswerRe: Patterns for data sorting/grouping in memory [modified] Pin
Alan Balkany5-Aug-08 4:42
Alan Balkany5-Aug-08 4:42 
AnswerRe: Patterns for data sorting/grouping in memory Pin
Mark Churchill5-Aug-08 4:45
Mark Churchill5-Aug-08 4:45 
QuestionBin Packing Algorithm [modified] Pin
248912830-Jul-08 2:22
248912830-Jul-08 2:22 
AnswerRe: Bin Packing Algorithm Pin
CPallini30-Jul-08 2:39
mveCPallini30-Jul-08 2:39 
AnswerRe: Bin Packing Algorithm Pin
Alan Balkany30-Jul-08 3:22
Alan Balkany30-Jul-08 3:22 
GeneralRe: Bin Packing Algorithm Pin
Paul Conrad30-Jul-08 6:12
professionalPaul Conrad30-Jul-08 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.