The algorithm that you select to use in a code shows how you’ve decided to search for a value. The cost of the algorithm depends on the variables involved.
Different methods have specific behaviors. The classes of algorithms are: linear, quadratic, log, exponential. Identifying the classes used within code is the “big picture” of lecture 8. The mathematical names of the algorithms describe how the code is behaving.
The growth behaviors of algorithms are illustrated in the first 4 code problems on the related resources handout. The first two show what linear and recursive algorithms look like in the code. The quadratic and exponential are located at 18:40 in the video.
1. The behavior of the linear algorithm is stepwise searching. The name of “the order of complexity” is “linear.”
2. The quadratic algorithm behaves by squaring (or cubing) a given procedure within the code. In the video, the order of complexity is n*m. However, if n = m, then you have n^2, and this is quadratic. (19:30 – 20:15).
3. The behavior of log is to cut the search by a fractional amount, such as ½, 1/3, etc. This tends to be efficient because it cuts down the search time by ½, 1/3, etc.
4. The behavior of exponents is outrageously rapid growth that is generally to be avoided.
The base case can be found quickly using one algorithm, but is extremely expensive when using a different algorithm. The efficient choice depends on the situation. Analyzing complexity is a matter of selecting the algorithm that is best matched to a given issue. The Towers of Hanoi illustrated the different efficiencies of different methods. Detailed algebra/calculus review for free at http://brightstorm.com/. Hope this helps someone.