Analyzing Algorithms

Serendipitous Design

Week 3 in Learn to Program: Crafting Quality Code covered Analyzing Algorithms and different sorting methods. In analyzing algorithms we determine how much time and other resources are spent on their execution.

To analyze an algorithm the focus was placed on how many times the print function gets called and then visualizing the run time. If a function has a runtime that grows linearly in respect to the size of the input it’s referred to as a linear function.

A quadratic function is a function, whose runtime grows in quadratic fashion compared to the size of the input.

 Finally, logarithmic functions use a mathematical operation to determine the runtime:

 \log_b(x) = n . \,\!

This operation determines how many number of times we have to divide a number(n) by 2 to reach 1.

This is especially useful when looking for a specific number in a large list. A quadratic function’s runtime grows more slowly, as its…

View original post 40 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s