

{"id":93011,"date":"2021-05-04T09:00:43","date_gmt":"2021-05-04T03:30:43","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=93011"},"modified":"2021-06-26T19:21:33","modified_gmt":"2021-06-26T13:51:33","slug":"asymptotic-analysis-of-algorithms-in-data-structures","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/","title":{"rendered":"Asymptotic Analysis of Algorithms in Data Structures"},"content":{"rendered":"<p>Assume your task is to clean your room. Now, what will be the difficulty of the task? It depends on how scattered the room is. If the room is already organized, it will take you no time, and if the room is highly scattered, it might take you hours to arrange it.<\/p>\n<p>So you see, the complexity or difficulty of any task is determined by how much time it takes for its completion. Similarly, it happens in a computer program also. While writing an algorithm, we need to make sure it works fastest with the given resources.<\/p>\n<p>In this article, we will learn what is asymptotic analysis, how to calculate time complexity, what are asymptotic notations, and the time complexity of some frequently used algorithms.<\/p>\n<h3>Asymptotic Analysis of Algorithms<\/h3>\n<p><span style=\"font-weight: 400;\">The asymptotic analysis defines the mathematical foundation of an algorithm\u2019s run time performance. If there is no input to an algorithm then the algorithm will always work in a constant time.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Asymptotic analysis is the running time of any process or algorithm in mathematical terms.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">We can calculate the best, average, and worst-case scenarios for an algorithm by using asymptotic analysis.<\/span><\/li>\n<\/ul>\n<h3>Basics of asymptotic analysis<\/h3>\n<p>In computer programming, the asymptotic analysis tells us the execution time of an algorithm. The lesser the execution time, the better the performance of an algorithm is.<\/p>\n<p>For example, let&#8217;s assume we have to add an element at the starting of an array. Since an array is a contiguous memory allocation, we cannot add an element at the first position directly. We need to shift each element to the next position and then only we can add elements at the first position. So we need to traverse the whole array once. The greater the array size, the longer the execution time.<\/p>\n<p>While performing a similar operation on a linked list is comparatively very easy since in a linked list each node is in connection with the next node via a pointer. We can just create a new node and point it to the first node of a linked list. So you can see that adding an element at the first position in a linked list is very much easier as compared to performing a similar operation on an array.<\/p>\n<p><span style=\"font-weight: 400;\">We similarly compare different data structures and select the best possible data structure for an operation. The less the execution time, the higher the performance.<\/span><\/p>\n<h3>How to find time complexity?<\/h3>\n<p>Computing the real running time of a process is not feasible. The time taken for the execution of any process is dependent on the size of the input.<\/p>\n<p>For example, traversing through an array of 5 elements will take less time as compared to traversing through an array of 500 elements. We can observe that time complexity depends on the input size.<\/p>\n<p>Hence, if the input size is \u2018n\u2019, then <strong>f(n) is a function of \u2018n\u2019 denoting the time complexity.<\/strong><\/p>\n<h3>How to calculate f(n) in data structure?<\/h3>\n<p><span style=\"font-weight: 400;\">Calculating f(n) value for small programs is easy as compared to bigger programs.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> We usually compare data structures by comparing their f(n)values. We also need to find the growth rate of an algorithm because in some cases there is a possibility that for a smaller input size, one data structure is better than the other but when the input data size is large, it\u2019s vice versa.<\/span><\/p>\n<p><strong>For example:<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">Let\u2019s assume a function f(n) = 8n<sup>2 <\/sup><\/span><span style=\"font-weight: 400;\">+5n+12.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here n represents the number of instructions executed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If n=1 :\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Percentage of time taken due to 8n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\"> = (<\/span><span style=\"font-weight: 400;\">8\/(<\/span><span style=\"font-weight: 400;\">8+5+12))<\/span><span style=\"font-weight: 400;\">*100 = 32%<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Percentage of time taken due to 5n = (<\/span><span style=\"font-weight: 400;\">5\/(<\/span><span style=\"font-weight: 400;\">8+5+12))<\/span><span style=\"font-weight: 400;\">*100 = 20%<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Percentage of time taken due to 12 =<\/span><span style=\"font-weight: 400;\"> (12\/(<\/span><span style=\"font-weight: 400;\">8+5+12))<\/span><span style=\"font-weight: 400;\">*100 = 48%<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the above example, we can see that most of the time is taken by \u201812\u2019. But based on only one example we cannot conclude time complexity. We have to calculate the growth factor and then observe the situation as we did in the table below.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">n<\/span><\/td>\n<td><span style=\"font-weight: 400;\">8n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><\/td>\n<td><span style=\"font-weight: 400;\">5n<\/span><\/td>\n<td><span style=\"font-weight: 400;\">12<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">32%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">20%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">48%<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">10<\/span><\/td>\n<td><span style=\"font-weight: 400;\">92.8%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">5.8%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">1.4%<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">100<\/span><\/td>\n<td><span style=\"font-weight: 400;\">99.36%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">0.62%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">0.015%<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">1000<\/span><\/td>\n<td><span style=\"font-weight: 400;\">99.93%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">0.06%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u2248 0 %<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In the above table, we can observe that the 8n2 term is contributing most of the time. It is so much greater than the other two terms that we can ignore those two terms. Therefore, the complexity for this algorithm is :<\/p>\n<p>F(n) = 8n<sup>2<\/sup><\/p>\n<p>This is the approximate time complexity which is very close to the actual result. This measure of approximate time complexity is known as asymptotic complexity.<\/p>\n<p>Here, we are considering the term which takes most of the time and eliminating the unnecessary terms. Though, we&#8217;re not calculating the exact running time still it is very close to it.<\/p>\n<p><span style=\"font-weight: 400;\">The time required for the execution of an algorithm is categorized into three types:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>Worst case:<\/b><span style=\"font-weight: 400;\"> the maximum time required for the execution<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Average case:<\/b><span style=\"font-weight: 400;\"> average time taken for the execution.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Best case:<\/b><span style=\"font-weight: 400;\"> minimum time taken for the execution.<\/span><\/li>\n<\/ul>\n<h3>Asymptotic notation<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-93162\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation.jpg\" alt=\"Asymptotic notation\" width=\"880\" height=\"750\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation.jpg 880w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation-300x256.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation-150x128.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation-768x655.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation-720x614.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation-520x443.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Asymptotic-notation-320x273.jpg 320w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Commonly used asymptotic notation for representing the runtime complexity of an algorithm are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Big O notation (O)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Omega notation (\u03a9)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Theta notation (\u03b8)<\/span><\/li>\n<\/ul>\n<h4>1. Big O notation (O)<\/h4>\n<p>This asymptotic notation measures the performance of an algorithm by providing the order of growth of the function. It provides an upper bound on a function ensuring that the function never grows faster than the upper bound.<\/p>\n<p>It measures the worst-case complexity of the algorithm. Calculates the longest amount of time taken for execution. Hence, it is a formal way to express the upper boundary of an algorithm\u2019s running time.<\/p>\n<p>Let\u2019s analyze the graph below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-upper-bound.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-93157\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-upper-bound.png\" alt=\"Graph for upper bound\" width=\"385\" height=\"323\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-upper-bound.png 385w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-upper-bound-300x252.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-upper-bound-150x126.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-upper-bound-320x268.png 320w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Let f(n), g(n) be two functions, where n <\/span><b>\u2208 <\/b><span style=\"font-weight: 400;\">Z<\/span><span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) = O(g(n)) [since f(n) is of the order of g(n)].\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If there exists constants \u2018c\u2019 and \u2018k\u2019 such that:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) \u2264 c.g(n) for all n\u2265k<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We can conclude that f(n), at no point after n=k, grows faster than g(n). Here, we are calculating the growth rate of the function. This calculates the worst time complexity of f(n).<\/span><\/p>\n<p><b>O(1) example:<\/b><span style=\"font-weight: 400;\">\u00a0 int arr=new int[10];<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">This step in any program will execute in O(1) time.<\/span><\/p>\n<p><b>O(n) example:<\/b><span style=\"font-weight: 400;\"> Traversing an array or a linked list. Traversing depends on the size of the array or linked lists.<\/span><\/p>\n<p><b>O(n<\/b><sup><b>2<\/b><\/sup><b>) example:<\/b><span style=\"font-weight: 400;\"> Bubble sort algorithm.<\/span><\/p>\n<h4>2. Omega notation (\u03a9)<\/h4>\n<p><span style=\"font-weight: 400;\">Opposite to big o notation, this asymptotic notation describes the best-case scenario. It is a formal way to present the lower bound of an algorithm running time. This means that this is the minimum time taken for the execution of an algorithm. It is the fastest time that an algorithm can run.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let\u2019s analyze the below graph :\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-lower-bound.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-93158\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-lower-bound.png\" alt=\"Graph for lower bound\" width=\"345\" height=\"224\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-lower-bound.png 345w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-lower-bound-300x195.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-lower-bound-150x97.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-lower-bound-320x208.png 320w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Let f(n), g(n) be two functions, where n <\/span><b>\u2208 <\/b><span style=\"font-weight: 400;\">Z<\/span><span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) = <\/span><span style=\"font-weight: 400;\">\u03a9<\/span><span style=\"font-weight: 400;\">(g(n)) [since f(n) is of the order of g(n)].<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If there exists constants \u2018c\u2019 and \u2018k\u2019 such that:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) &gt;= c.g(n) for all n\u2265k and c&gt;0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As you can observe in the above graph that g(n) is the lower bound of the f(n). Hence, this notation gives us the fastest running time. But, we are not interested in the fastest running time. Instead, we are interested in calculating the worst-case scenarios. Because we need to check our algorithm for larger input and what is the worst time that it will take to execute.\u00a0<\/span><\/p>\n<h4>3. Theta notation (\u03b8)<\/h4>\n<p><span style=\"font-weight: 400;\">This asymptotic notation describes the average case scenario. An algorithm cannot perform worst or best especially when the problem is a real-world problem. The time complexity fluctuates between best case and worst case and this is given by theta notation (\u03b8) which describes the average case.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Theta notation is mainly used when the value of the worst-case and best-case are the same. It represents both the upper bound and the lower bound of the running time for an algorithm.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let f(n), g(n) be two functions , where n <\/span><b>\u2208 <\/b><span style=\"font-weight: 400;\">Z<\/span><span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) = <\/span><span style=\"font-weight: 400;\">\u03b8<\/span><span style=\"font-weight: 400;\">(g(n)) [since f(n) is of the order of g(n)].<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If there exists constants \u2018c\u2019 and \u2018k\u2019 such that:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">c<\/span><sub><span style=\"font-weight: 400;\">1<\/span><\/sub><span style=\"font-weight: 400;\">.g(n) &lt;= f(n) &lt;= c<\/span><sub><span style=\"font-weight: 400;\">2<\/span><\/sub><span style=\"font-weight: 400;\">.g(n)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here f(n) has a limitation of an upper bound and a lower bound. The condition f(n)= \u03b8g(n) will be true only if it satisfies the above equation. Below is the graphical representation of theta notation is:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/graph-for-average-case.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-93159\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/graph-for-average-case.png\" alt=\"graph for average case\" width=\"317\" height=\"232\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/graph-for-average-case.png 317w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/graph-for-average-case-300x220.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/graph-for-average-case-150x110.png 150w\" sizes=\"auto, (max-width: 317px) 100vw, 317px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Let us see an example for better understanding :<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Assume we have to reverse the string: \u201cDATAFLAIR\u201d<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let\u2019s have a look at the traditional Algorithm for it :<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 1<\/strong>: Start<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 2<\/strong>: Declare two variables str1 and str2.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 3<\/strong>: Initialize the variable str1 with \u201cDATAFLAIR\u201d<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 4:<\/strong> Go to the last character of str1<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 5:<\/strong> Take each character starting from the end, from str1, and append it to str2.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 6:<\/strong> Print str2<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Step 7:<\/strong> Stop<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the above algorithm, each time step 5 is executed, a new string is created. It does not append it to the original string. Instead, it creates a new string and assigns it to str2 every time. Thus the complexity for this algorithm is O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But in JAVA, we have the StringBuffer.reverse() function which reserves room for characters without reallocation. Therefore, reversing a string using StringBuffer.reverse() in JAVA is possible only in O(1).<\/span><\/p>\n<h3>What is the need for Asymptotic analysis?<\/h3>\n<p><span style=\"font-weight: 400;\">Let\u2019s compare linear search and binary search algorithms:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Execution time for linear search: <\/span><b>a*n<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Execution time for binary search:<\/span><b> b*(log n)<\/b><\/p>\n<p><span style=\"font-weight: 400;\">a,b =&gt; contents, n=&gt; input size.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Since n &gt; log n, linear search takes more time to execute than binary search. But what if Linear search is executed on a very faster system.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Machine A (Linear Search )<\/b><\/td>\n<td><b>Machine B (Binary Search)<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">10^<\/span><span style=\"font-weight: 400;\">9<\/span><span style=\"font-weight: 400;\"> instructions per second<\/span><\/td>\n<td><span style=\"font-weight: 400;\"> 10^<\/span><span style=\"font-weight: 400;\">6<\/span><span style=\"font-weight: 400;\"> instructions per second<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">For n=1000:\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Execution time =\u00a0 n \/ 10<\/span><sup><span style=\"font-weight: 400;\">9<\/span><\/sup><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= 1000 \/ 10<\/span><sup><span style=\"font-weight: 400;\">9<\/span><\/sup><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= 10<\/span><sup><span style=\"font-weight: 400;\">-6<\/span><\/sup><span style=\"font-weight: 400;\"> seconds<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(FASTER)\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">For n = 1000:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Execution time =\u00a0 log<\/span> <span style=\"font-weight: 400;\">n \/ 10<\/span><sup><span style=\"font-weight: 400;\">6<\/span><\/sup><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= log 1000 \/ 10<\/span><sup><span style=\"font-weight: 400;\">6<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/sup><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= 3 * 10<\/span><sup><span style=\"font-weight: 400;\">-6<\/span><\/sup><span style=\"font-weight: 400;\"> seconds<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(SLOWER)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">For n=1000000 ( 1 million ):\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Execution time =\u00a0 n \/ 10<\/span><sup><span style=\"font-weight: 400;\">9<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/sup><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= 1000000 \/ 10<\/span><sup><span style=\"font-weight: 400;\">9<\/span><\/sup><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= 10<\/span><sup><span style=\"font-weight: 400;\">-3<\/span><\/sup><span style=\"font-weight: 400;\"> seconds<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(SLOWER)<\/span><\/td>\n<td><span style=\"font-weight: 400;\">For n=1000000 ( 1 million ):\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Execution time =\u00a0 log n \/ 10<\/span><sup><span style=\"font-weight: 400;\">9<\/span><\/sup><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= log 1000000 \/ 10<\/span><sup><span style=\"font-weight: 400;\">9<\/span><\/sup><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0= 5 * 10<\/span><sup><span style=\"font-weight: 400;\">-9<\/span><\/sup><span style=\"font-weight: 400;\"> seconds<\/span><\/p>\n<p><span style=\"font-weight: 400;\">(FASTER)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">We can see that linear search works better for a shorter input but binary search works better for larger input even though the linear search is run on a faster system. This is why we need asymptotic analysis so that we can calculate time complexity as close to the real value as possible.<\/span><\/p>\n<h3>Why have three different notations?<\/h3>\n<p>Let\u2019s try to find out the complexity of the linear search algorithm. Suppose you want to search an element in an array using the linear search algorithm. In a linear search algorithm, the search element is compared to each element of the array.<\/p>\n<p>If the element is found at the first position itself, it is a best-case and the program will take the least time for execution. The complexity will be \u03a9(1). If the element is found at the last position, it will be the worst-case scenario and the program will take maximum time for execution. Its time complexity will be O(n).<\/p>\n<p>The average case complexity is between worst case and best case so it becomes \u03b8(n\/1). Since we can ignore the constant terms in asymptotic notations the average-case complexity will be \u03b8(n).<\/p>\n<h3>Some more Asymptotic Notation in Data Structures<\/h3>\n<p>Following are 2 more asymptotic notation used:<\/p>\n<h4>1. Little \u2018\u03bf\u2019 notation<\/h4>\n<p>This notation provides a loose upper bound on a function. Little order is an estimate of the order of growth, unlike big O, which is an actual order of growth.<\/p>\n<p>Let\u2019s analyze the graph below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-upper-bound.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-93160 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-upper-bound.png\" alt=\"Graph for loose upper bound in asymptotic analysis\" width=\"360\" height=\"285\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-upper-bound.png 360w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-upper-bound-300x238.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-upper-bound-150x119.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-upper-bound-320x253.png 320w\" sizes=\"auto, (max-width: 360px) 100vw, 360px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Let f(n), g(n) be two functions, where n <\/span><b>\u2208 <\/b><span style=\"font-weight: 400;\">Z<\/span><span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) = o(g(n)) [since f(n) is of the order of g(n)].\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If for any constant \u2018c\u2019 &gt; 0 , there exists a constant \u2018k\u2019 &gt;1, such that:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">0 \u2264 f(n) \u2264 c.g(n).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We can conclude that f(n), at no point after n=k, grows faster than g(n). Here, we are calculating the approximate growth rate of the function.\u00a0<\/span><\/p>\n<h4>2. Little \u03c9 notation<\/h4>\n<p>This notation provides a loose lower bound on a function. Little order is an estimate of the order of growth, unlike big \u03a9, which is the actual order of growth.<\/p>\n<p>Let\u2019s analyze the graph:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-lower-bound.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-93161\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-lower-bound.png\" alt=\"Graph for loose lower bound\" width=\"374\" height=\"265\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-lower-bound.png 374w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-lower-bound-300x213.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-lower-bound-150x106.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/Graph-for-loose-lower-bound-320x227.png 320w\" sizes=\"auto, (max-width: 374px) 100vw, 374px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Let f(n), g(n) be two functions, where n <\/span><b>\u2208 <\/b><span style=\"font-weight: 400;\">Z<\/span><span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) = <\/span><b>\u03c9<\/b><span style=\"font-weight: 400;\">(g(n)) [since f(n) is of the order of g(n)].\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If for any constant \u2018c\u2019 &gt; 0 , there exists a constant \u2018k\u2019 &gt;=1, such that:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">f(n) &gt; c.g(n) &gt;=0, for every integer n&gt;=k<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3>Advantages of asymptotic notations<\/h3>\n<p><span style=\"font-weight: 400;\">1. Asymptotic analysis is the best and efficient way of analyzing algorithms with actual runtime inputs.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. Analyzing algorithms manually is not feasible as the performance of the algorithms changes with the input change. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Also, the algorithm\u2019s performance changes with different machines. Therefore, having a mathematical representation that gives us the actual insight of the maximum and minimum time taken for execution is better.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3. We can represent the upper bound or lower bound of execution time in the form of mathematical equations.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">4. Asymptotic analysis of algorithms helps us in performing our task with the best efficiency and fewer efforts.<\/span><\/p>\n<h3>Commonly used asymptotic notations<\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Type\u00a0<\/b><\/td>\n<td><b>Big O notation<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Constant<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(1)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Linear<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Logarithmic<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(log n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">N log n<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n log(n))<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">exponential<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2<\/span><sup><span style=\"font-weight: 400;\">O(n)<\/span><\/sup><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">cubic<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">3<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">polynomial<\/span><\/td>\n<td><span style=\"font-weight: 400;\">n<\/span><sup><span style=\"font-weight: 400;\">O(1)<\/span><\/sup><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">quadratic<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Run time performance of the above complexities are :<\/p>\n<p>O(1) &lt; O(log n) &lt; O(n) &lt; O(n log n) &lt; O(n<sup>2<\/sup>) &lt; O (n<sup>3<\/sup>)&lt; O(2<sup>n<\/sup>) &lt; O(n!)<\/p>\n<h3>Time Complexity of some frequently used algorithms<\/h3>\n<p>Below is the list of some commonly used algorithms and their worst-case complexities. We will learn how to calculate these complexities in future articles.<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Algorithm<\/b><\/td>\n<td><b>Worst Case Time Complexity<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Linear search<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Binary Search<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(log n)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Selection sort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bubble Sort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Insertion sort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Merge Sort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n log(n))<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Quicksort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bucket sort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(n<\/span><sup><span style=\"font-weight: 400;\">2<\/span><\/sup><span style=\"font-weight: 400;\">)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Radix sort<\/span><\/td>\n<td><span style=\"font-weight: 400;\">O(nk)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Conclusion<\/h3>\n<p>In this article, we learned what are asymptotic notations. Now we are aware of how to calculate asymptotic notations and time complexities for different kinds of algorithms.<\/p>\n<p>We also observed the mathematical graphs and proofs for best case, worst case, and average case scenarios. We will see detailed derivations of the complexities for the above-mentioned algorithms in future articles.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assume your task is to clean your room. Now, what will be the difficulty of the task? It depends on how scattered the room is. If the room is already organized, it will take&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":93155,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24020],"tags":[24194,24195,24196,24197,24198],"class_list":["post-93011","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structure-tutorials","tag-asymptotic-analysis","tag-asymptotic-analysis-data-structure","tag-asymptotic-analysis-of-algorithms","tag-asymptotic-notation","tag-asymptotic-notation-in-data-structures"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Asymptotic Analysis of Algorithms in Data Structures - DataFlair<\/title>\n<meta name=\"description\" content=\"Asymptotic analysis refers to computing the running time of any operation in mathematical units of computation. Learn more about it.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Asymptotic Analysis of Algorithms in Data Structures - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Asymptotic analysis refers to computing the running time of any operation in mathematical units of computation. Learn more about it.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-04T03:30:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-26T13:51:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/DS-Asymptotic-analysis.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Asymptotic Analysis of Algorithms in Data Structures - DataFlair","description":"Asymptotic analysis refers to computing the running time of any operation in mathematical units of computation. Learn more about it.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/","og_locale":"en_US","og_type":"article","og_title":"Asymptotic Analysis of Algorithms in Data Structures - DataFlair","og_description":"Asymptotic analysis refers to computing the running time of any operation in mathematical units of computation. Learn more about it.","og_url":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-05-04T03:30:43+00:00","article_modified_time":"2021-06-26T13:51:33+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/DS-Asymptotic-analysis.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Asymptotic Analysis of Algorithms in Data Structures","datePublished":"2021-05-04T03:30:43+00:00","dateModified":"2021-06-26T13:51:33+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/"},"wordCount":2338,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/DS-Asymptotic-analysis.jpg","keywords":["Asymptotic Analysis","Asymptotic Analysis data structure","Asymptotic Analysis of algorithms","Asymptotic Notation","Asymptotic Notation in Data Structures"],"articleSection":["Data Structure Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/","url":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/","name":"Asymptotic Analysis of Algorithms in Data Structures - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/DS-Asymptotic-analysis.jpg","datePublished":"2021-05-04T03:30:43+00:00","dateModified":"2021-06-26T13:51:33+00:00","description":"Asymptotic analysis refers to computing the running time of any operation in mathematical units of computation. Learn more about it.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/DS-Asymptotic-analysis.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/05\/DS-Asymptotic-analysis.jpg","width":1200,"height":628,"caption":"DS Asymptotic analysis"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/asymptotic-analysis-of-algorithms-in-data-structures\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Data Structure Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/data-structure-tutorials\/"},{"@type":"ListItem","position":3,"name":"Asymptotic Analysis of Algorithms in Data Structures"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/93011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=93011"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/93011\/revisions"}],"predecessor-version":[{"id":97804,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/93011\/revisions\/97804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/93155"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=93011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=93011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=93011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}