Stuart’s MATLAB Videos

Naive vs Complex solutions

Posted by Doug Hull,

This video is more philosophical than about MATLAB syntax. When trying to understand the cycles that occur in the output of a pseudo random number generator, I first approached the problem in easiest way I could think of. It worked well enough for small datasets, but because the computational order of complexity grew by N^2, this did not work very well. It took someone pointing out an algorithm that grew linearly with N to complete the job.

This kind of algorithmic innovation is needed in many cases because the profiler can help you on a line by line basis, but it can not find systematic problems like this.

Add A Comment

What is 4 + 9?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.