{"componentChunkName":"component---src-templates-blog-post-jsx","path":"/blogs/analysisOfAlgorithms","result":{"data":{"blog":{"frontmatter":{"title":"ANALYSIS OF ALGORITHMS","thumbnail":"blog53","date":"April 3, 2021","dsaCppCodeFile":null},"excerpt":"<div class=\"my-2 p-2\">\n              <h4>Introduction</h4>\n              <div class=\"m-2\">\n                <p>\n                  Algorithm analysis is a study that provides theoritical\n                  estimation for the required resources of an algorithm to solve\n                  a specific problem. It's based on two factors:\n                  <strong>Time Complexity</strong> and\n                  <strong>Space Complexity</strong>\n                </p>\n                <p>\n                  We know that for a given problem, there can be n no. of\n                  algorithms that can solve the same problem.(For example; for\n                  sorting problem we have quick sort, selection sort, bubble\n                  sort, insertion sort, merge sort etc.). So algorithm analysis\n                  helps us to determine which algorithm is most efficient in\n                  terms of time and space consumed.\n                </p>\n                <p>\n                  The goal of the analysis of algorithms is to compare\n                  algorithms (or solutions) mainly in terms of running time but\n                  also in terms of other factors (e.g., memory, developer\n                  effort, etc.)\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Run time Analysis</h4>\n              <div class=\"m-2\">\n                <p>\n                  It is the process of determining how processing time increases\n                  as the size of the problem (input size) increases.\n                </p>\n                <p>\n                  Input size is the number of elements in the input, and\n                  depending on the problem type, the input may be of different\n                  types. The following are the common types of inputs:\n                </p>\n                <ul class=\"pl-4\">\n                  <li>Size of an array.</li>\n                  <li>Polynomial Degree.</li>\n                  <li>No. of elements in a matrix.</li>\n                  <li>\n                    Number of bits in the binary representation of the input.\n                  </li>\n                  <li>Vertices and edges in a graph.</li>\n                </ul>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Rate of Growth</h4>\n              <p>\n                The rate at which the running time increases as a function of\n                input is called rate of growth.\n              </p>\n              <div class=\"col-md-7 mx-auto m-2 table-responsive\">\n                <table class=\"table table-sm table-striped\">\n                  <caption class=\"text-center\">\n                    Commonly used Rate of Growths\n                  </caption>\n                  <thead class=\"thead-dark\">\n                    <tr>\n                      <th>Time Complexity</th>\n                      <th>Name</th>\n                    </tr>\n                  </thead>\n                  <tbody>\n                    <tr>\n                      <td>1</td>\n                      <td>Constant</td>\n                    </tr>\n                    <tr>\n                      <td>logn</td>\n                      <td>Logarthmic</td>\n                    </tr>\n                    <tr>\n                      <td>n</td>\n                      <td>Linear</td>\n                    </tr>\n                    <tr>\n                      <td>nlogn</td>\n                      <td>Linear Logarthmic</td>\n                    </tr>\n                    <tr>\n                      <td>n<sup>2</sup></td>\n                      <td>Quadratic</td>\n                    </tr>\n                    <tr>\n                      <td>n<sup>3</sup></td>\n                      <td>Cubic</td>\n                    </tr>\n                    <tr>\n                      <td>2<sup>n</sup></td>\n                      <td>Exponential</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Types of Analysis</h4>\n              <ol class=\"pl-4\">\n                <li>\n                  <strong> Worst Case: </strong>Defines the input for which the\n                  algorithm takes long time.\n                </li>\n                <li>\n                  <strong> Best Case: </strong>Defines the input for which the\n                  algorithm takes least time.\n                </li>\n                <li>\n                  <strong> Worst Case: </strong>Defines the input for which the\n                  algorithm takes average time. Provides the prediction about\n                  the runtime of the algorithm.\n                </li>\n              </ol>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Asymptotic Notations</h4>\n              <div class=\"m-2\">\n                <p>\n                  Asymptotic Notations are the expressions that are used to\n                  represent the complexity of an algorithm.\n                  <br />\n                  Types:\n                </p>\n                <ol class=\"pl-4\">\n                  <li>\n                    <strong>Big-O Notation (Ο): </strong>Big O notation\n                    specifically describes worst case scenario.\n                  </li>\n                  <li>\n                    <strong>Omega Notation (Ω): </strong>Omega(Ω) notation\n                    specifically describes best case scenario.\n                  </li>\n                  <li>\n                    <strong>Theta Notation (θ): </strong>Theta(θ) notation\n                    represents the average complexity of an algorithm.\n                  </li>\n                </ol>\n              </div>\n                <div class=\"my-2 p-2\">\n                    <strong>Similar posts:</strong>\n                    <a href=\"/blogs/introductionToAlgorithms\"\n                    >Introduction to Algorithms</a\n                    > | <a href=\"/blogs/timeComplexity\"\n                    >Time Complexity</a\n                    >\n                </div>\n            </div>\n","html":"<div class=\"my-2 p-2\">\n              <h4>Introduction</h4>\n              <div class=\"m-2\">\n                <p>\n                  Algorithm analysis is a study that provides theoritical\n                  estimation for the required resources of an algorithm to solve\n                  a specific problem. It's based on two factors:\n                  <strong>Time Complexity</strong> and\n                  <strong>Space Complexity</strong>\n                </p>\n                <p>\n                  We know that for a given problem, there can be n no. of\n                  algorithms that can solve the same problem.(For example; for\n                  sorting problem we have quick sort, selection sort, bubble\n                  sort, insertion sort, merge sort etc.). So algorithm analysis\n                  helps us to determine which algorithm is most efficient in\n                  terms of time and space consumed.\n                </p>\n                <p>\n                  The goal of the analysis of algorithms is to compare\n                  algorithms (or solutions) mainly in terms of running time but\n                  also in terms of other factors (e.g., memory, developer\n                  effort, etc.)\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Run time Analysis</h4>\n              <div class=\"m-2\">\n                <p>\n                  It is the process of determining how processing time increases\n                  as the size of the problem (input size) increases.\n                </p>\n                <p>\n                  Input size is the number of elements in the input, and\n                  depending on the problem type, the input may be of different\n                  types. The following are the common types of inputs:\n                </p>\n                <ul class=\"pl-4\">\n                  <li>Size of an array.</li>\n                  <li>Polynomial Degree.</li>\n                  <li>No. of elements in a matrix.</li>\n                  <li>\n                    Number of bits in the binary representation of the input.\n                  </li>\n                  <li>Vertices and edges in a graph.</li>\n                </ul>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Rate of Growth</h4>\n              <p>\n                The rate at which the running time increases as a function of\n                input is called rate of growth.\n              </p>\n              <div class=\"col-md-7 mx-auto m-2 table-responsive\">\n                <table class=\"table table-sm table-striped\">\n                  <caption class=\"text-center\">\n                    Commonly used Rate of Growths\n                  </caption>\n                  <thead class=\"thead-dark\">\n                    <tr>\n                      <th>Time Complexity</th>\n                      <th>Name</th>\n                    </tr>\n                  </thead>\n                  <tbody>\n                    <tr>\n                      <td>1</td>\n                      <td>Constant</td>\n                    </tr>\n                    <tr>\n                      <td>logn</td>\n                      <td>Logarthmic</td>\n                    </tr>\n                    <tr>\n                      <td>n</td>\n                      <td>Linear</td>\n                    </tr>\n                    <tr>\n                      <td>nlogn</td>\n                      <td>Linear Logarthmic</td>\n                    </tr>\n                    <tr>\n                      <td>n<sup>2</sup></td>\n                      <td>Quadratic</td>\n                    </tr>\n                    <tr>\n                      <td>n<sup>3</sup></td>\n                      <td>Cubic</td>\n                    </tr>\n                    <tr>\n                      <td>2<sup>n</sup></td>\n                      <td>Exponential</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Types of Analysis</h4>\n              <ol class=\"pl-4\">\n                <li>\n                  <strong> Worst Case: </strong>Defines the input for which the\n                  algorithm takes long time.\n                </li>\n                <li>\n                  <strong> Best Case: </strong>Defines the input for which the\n                  algorithm takes least time.\n                </li>\n                <li>\n                  <strong> Worst Case: </strong>Defines the input for which the\n                  algorithm takes average time. Provides the prediction about\n                  the runtime of the algorithm.\n                </li>\n              </ol>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Asymptotic Notations</h4>\n              <div class=\"m-2\">\n                <p>\n                  Asymptotic Notations are the expressions that are used to\n                  represent the complexity of an algorithm.\n                  <br />\n                  Types:\n                </p>\n                <ol class=\"pl-4\">\n                  <li>\n                    <strong>Big-O Notation (Ο): </strong>Big O notation\n                    specifically describes worst case scenario.\n                  </li>\n                  <li>\n                    <strong>Omega Notation (Ω): </strong>Omega(Ω) notation\n                    specifically describes best case scenario.\n                  </li>\n                  <li>\n                    <strong>Theta Notation (θ): </strong>Theta(θ) notation\n                    represents the average complexity of an algorithm.\n                  </li>\n                </ol>\n              </div>\n                <div class=\"my-2 p-2\">\n                    <strong>Similar posts:</strong>\n                    <a href=\"/blogs/introductionToAlgorithms\"\n                    >Introduction to Algorithms</a\n                    > | <a href=\"/blogs/timeComplexity\"\n                    >Time Complexity</a\n                    >\n                </div>\n            </div>"},"thumbnail":{"childImageSharp":{"fluid":{"tracedSVG":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='400'%20height='225'%20viewBox='0%200%20400%20225'%20preserveAspectRatio='none'%3e%3cpath%20d='M29%2094c-1%201-7%2017-6%2018%201%202%205%201%205%200%200-4%205-3%205%200%200%202%205%201%205%200l-1-8c-2-9-4-13-8-10m11%203l-1%2010c0%206%200%206%203%206%202%200%202%200%202-5v-4l2%204c1%204%202%205%204%205s3-1%203-10c0-10%200-10-2-10s-3%201-3%204l-1%203v-3c-2-5-6-6-7%200m20-2l-6%2016c0%201%201%202%203%202l2-1c0-2%202-3%204-3l1%202c0%201%201%202%203%202%203%200%203-1%200-11-1-9-4-12-7-7m11%202l-1%2010c0%207%201%207%209%205%205-1%204-5-1-5h-3v-7c0-6%200-7-2-7-1%200-2%201-2%204m13-3c-2%200-2%200%200%207l2%209c0%203%200%203%202%203%203%200%203%200%203-3l3-8%202-8c-1-2-4-1-5%203l-2%203-1-3-2-4-2%201m18%200c-5%201-5%208-1%2011%203%202%203%205%200%203h-3c-1%202-1%203%203%204%207%203%2011-5%205-10-3-2-3-3-2-4h1c0%202%201%202%203%202%202-1%202-1%202%206s0%207%202%207l3-1h4c7%203%2012-4%206-10l-3-4%202%201%202%201c3%200%203-5%200-6-7-3-12%207-6%2011%204%203%203%205-1%203-1-1-2-1-3%201-1%201-1-1-1-7l1-9h-2l-3%201v2c0%202-2%203-2%201%200-3-4-4-7-3m37%202c-3%203-3%2012%200%2015%205%205%2011%200%2011-10%200-8-7-11-11-5m16-2c-3%201-4%201-4%209v9c2%202%204%200%205-3%200-2%201-3%203-3s3-1%203-3%200-2-3-2c-4%201-4-2%200-3%205-1%205-1%205-3-1-2-4-2-9-1m144%2012l-1%208v7h9c8%200%209%201%209%203s0%202-2%202c-5-1-16%2013-21%2026l-3%2020%206-7c4-5%206-7%2010-8%206-3%206-2%206%201%200%202%200%202%201%201h3l-2-5-2-7-1-3v-3c3-2%2013-2%2013%200l-2%201-2%201h6l-1%202-1%203-2%207-2%204h3c2%200%202-1%201-3%200-2%200-2%207%200%204%201%205%202%207%205l3%204%201%203%202%206%202%204%201%204c2%207-1%2010-9%208h-4v-24h-15v-3l-1-3-1%203v3h-17v7l-1%208c-2%202-2%203-1%203%202%200%203%204%202%206l-8%201c-5%200-6%200-8-3-1-2-1-2%201-6%204-6%203-7-1-2-3%203-4%205-4%207%200%203%200%203-9%204-9%200-9%200-9%202s1%203%205%203h5l-1%204v3h97l1-4c1-2%202-3%205-3%205-1%205-4%200-5h-3v-14c0-14-1-21-4-21l-2-2c-1-2-1-2-1%200%200%203-8%203-8-1%200-2%200-2%202-2%202%201%203%200%201-1-2-2-1-4%203-12%206-11%205-17-1-20l-3-2-1-1-1-4-1-5c-1-1-1%201-1%204v5l-3-1c-3-1-22%200-24%201-1%201-1-1-1-4v-5l-14-1-13%201m2%207v7h22v-3l1-3v-1l-1-3v-3h-22v6M27%20130c-3%207-5%2015-4%2015%201%202%204%201%205-1l2-2%203%202c0%201%201%202%203%202s2%200%201-5c-1-11-2-14-5-15-3%200-3%200-5%204m13-3l-1%2010v9h3l6-1%203-1c0-2%200-2%202%200%204%204%2011%200%2011-6-1-4-7-4-6%200l-1%203v-8c0-2%202-2%202%200l3%201c3%200%203-5%200-7-5-3-10%201-11%208%200%205%200%205-4%205h-3v-7c0-6%200-7-2-7l-2%201m27%202c-4%205-2%2017%204%2017%203%200%207-6%207-11%200-9-6-12-11-6m15-2c-2%200-3%204-3%2012%200%205%200%206%202%206s3-2%202-4c0-2%202-1%204%202%201%203%202%203%203%201%202-1%202-1%201-3-1-3-1-4%201-6%203-7-2-10-10-8m12%206a520%20520%200%20012%2013c2%200%203-1%203-7l1-7%202-1c2%200%202%201%202%207%200%207%200%208%202%208s3-4%203-12c0-2%200-3%202-3l2-2c0-3%200-3-9-3H94v7m21-5l-1%2010c0%207%200%208%202%208s3-1%203-4%201-4%202-4%202%201%201%204c0%203%200%203%203%203h3v-9c0-10%200-10-2-10-3%200-3%200-3%204%200%202%200%203-2%203s-2%200-2-3c1-4%201-4-1-4s-3%201-3%202m15-1v19c2%200%204-1%204-3s0-2%202%200h2c2-2%202-2%202%200s1%203%203%203%202%200%202-10c0-8-1-10-2-10-2%200-3%201-4%204l-2%204-1-4c-2-4-4-5-6-3m19%201c-3%202-3%207%201%2010%204%202%203%204-1%203-2-1-3%201-2%203s6%202%209%201c3-3%203-7-1-10-3-2-3-3-2-4h1l2%202%202-2c0-5-4-6-9-3m121%2013l1%209h12v-18h-13v9m3%2023l-1%205c0%203%200%204-1%203%200-4-2-3-3%200l2%204%202%203%203%201c2%200%202%200%202-3%200-2%200-3%202-3s2-1%202-4l-1-4-1%203c0%204-2%203-2-2-1-3-1-4-4-3'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e","aspectRatio":1.7699115044247788,"src":"/static/af4dcf11f741efc54dc3669753fa8281/ee604/blog53.png","srcSet":"/static/af4dcf11f741efc54dc3669753fa8281/69585/blog53.png 200w,\n/static/af4dcf11f741efc54dc3669753fa8281/497c6/blog53.png 400w,\n/static/af4dcf11f741efc54dc3669753fa8281/ee604/blog53.png 800w,\n/static/af4dcf11f741efc54dc3669753fa8281/f3583/blog53.png 1200w,\n/static/af4dcf11f741efc54dc3669753fa8281/e4d72/blog53.png 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"pageContext":{"blog":"analysisOfAlgorithms","thumbnail":"thumbnails/blog53.png"}},"staticQueryHashes":["2987289216","63159454"]}