Transcripts
1. Introduction to the Course: Hi, friend. I am done and I will be your instructor for the scores on analysis off Gordon's. I am a software developer and I have been programming for the past seven years. My experience. I have found out a grinding ambition and helped my score as all this being appreciated in industry on the system. This is a big artoms means understanding resource requirements off guard improve its performance. Their main reasons for analyzing clusters greatness. You need to make sure that they got folks as expected. The second is efficiency. It must be lazing on leaving resources. This course will help you and why skins required the objectives for this course. Lay a solid foundation on which you can develop your. Regardless, you learn to measure the performance of their garden in terms of the standard rotations used in taking. This course will help you. It's your upcoming, according into this course is, well, structure for you into a curriculum, but just being divided into 20 plus. We do lectures on a wide range of practice examples, whizzes and directed motions. You take the scores if you are studying or learning science in your 100 X or repenting for according into are you are planning to learn data centers? Do you have a desire to be contributor with open source community? This course comes lifetime exes, and you will be rewarded with a certificate of completion. So what are you waiting for? It's time and roll lunch and master.
2. What is an Algorithm?: Welcome to the course on the analysis. Off begin. Let's start with a simple problem. Suppose you have to find the largest number from 200 numbers. This problem lights in your country Get Psaltis. If you have a 1,000,000 numbers and you need to find the largest numbers can really trust Rating. Way Way is a set off steps for a computer program for accomplishing a cast computer Science. A garden sport logic behind program and garden is independent. Any programming language? Let's talk about fuel Garzon's that are being used in our daily life without our noticing. When you're trying to get an over commute from place A to Place B, an algorithm is working for you to connect you to the nearest cab available when you're trying to book a flight or hotel room and Al Gore is sitting behind the screen, fed you depressed off of elements when you're watching a movie on Netflix and all garden is being used to make the streaming as smooth as possible. Give you the best experience when you buy a product from Amazon. Lord them is fucking behind the curtains. You suggest most frequently board items along with your friend but the's with examples off some of the very sophisticated gardeners and what makes an endorphin sophisticated directness and efficiency. And it brings you a rather complex broken. You know it's talk about its characteristics. Often, anyone guard sequins off unambiguous instructions, and garden has a range off legitimate inputs and should produce correct reserved for all values within the range. Letting too many inputs should be specified for the garden. There are different days or solving many problems. Different L. Gordon's Can we give love acts? Perform the same function. Performance off 12 gardens that perform the same function native. Our freedoms of speed, our use of resources. Not since we learned what an analogue Artemus. Let's start the scores on analysts off gardens because a credit you analyzing a guard, um, for a problem after you go give instructions to the beautiful. But analysts results in better efficiency
3. Properties of Algorithms: In this letter, we will discuss properties of gardens and in Gotham must satisfy the following properties. The first property is and what the garden must have input values from a specified set. The second property is the output. The guard, um, must produce the output values from a specified set off in prevents. The output values are the solution to the problem. The property is the finite nous off. So for any input, the garden must terminate after a finite number of steps, as you can see in the garden as shown in the diagram, it dominates in three steps, so an algorithm should not run endlessly before property is definite. Nous all steps off the L Garden must be precisely defined kind of property is the effectiveness opening, so it must be possible to perform each step of the way Bardem correctly. And in a finite amount of time, that is, the SEPs should be basic enough so that, for example, someone using a pencil and a paper would get them out exactly. And enough financial Morgenstein. So it is not enough that it step off a guard. Come is definite or presents two different, but it must also be feasible
4. Goal of Analysing Algorithms: in this lecture, let's discuss why the analyst Isabel Gardens is really important. Every program, no matter how trivial, Ex some amount of time to run on a computer. Additionally, all programs require some amount off memory to store temporary visitors. This arises. You do the time and space complexity off the 40 on guard. Um, analysis Is the science off knowing how complex analog Artemus in terms off time in space? Analyzing Elgort, um, means little mining in algorithm. Stump your facial complex speak that is estimating the amount of time and storage space and other resources it consumes. While executing these estimates relied an insight into reasonable directions off search for official Al Gore. For a human problem, the endless is often ill garden and help us understand it better and answer just informed improvements. The more complicated the garden, the more difficult the analysts. But it is not unusual for an AL Garden to become simpler and more elegant during the analyst this process, more importantly, careful scrutiny required for proper analysts is often leads to better and more efficient implementation on particle computes analysts is requires a far more complete understanding . Often l bottom that can inform the process off producing of working implementation. Indeed, when the results off analytic and empirical studies agree, we become strongly convinced off the validity of the garden as well is off the correctness off the process off analysis, and we can see that Gordon's tend to become shortened, simpler and more elegant during the analysts process so we can come to a conclusion that endless is awfully. Gardens is the first and the most important step in the process off solving a simple moderate or even a complex problem.
5. Time Complexity: in this lecture, they will discuss border topic. I'm complexity find complexity often in the garden signifies the total time required by the program to run till its completion. It is formally estimate early, but coming the number of elementary operations performed by the Garden to finish the execution on the time consume. But each elementary operation depends on a lot of things, like hardware operating system processors. That's a pretty. However. We don't consider any of these factors by analyzing, and we suppose that they take a fixed amount of time. So we really consider only the execution time. We will not be considering the time taken. Do these stats does the time complexity Often algorithm quantifies the amount of time taken by the garden as a functional lend off the input. Since the number of elementary operations are directly proportional to the length of the input pin day, we will prove this in a vial with an example. The time complexity offer me algorithms is most warmly expressed using the Big One audition . It is an ace imported notation to represent the time complexity. We just started about it in detail in the upcoming to do It so by analyzing a little garden and complexity is considered to lead a major factor. No, let's start the lesson believes up. Suppose you are given a, um and indeed er, thanks. And you have to find if X exists in the A or not. So simple solution to this problem is to reverse be cool at a and check if the the animals were searching for is present or not. So we have to check in the every that the at every element is equal to X they So let us see a taken example of Eddie. We have this ready on the elements are something like three doing Find one floor and let's say we have to search for the element for which is present here, right? No, this is the poor for 30 an element in another. Now each of the operation in computer take approximately on Sunday. Let's say each operation X a constant thing. See right. The number of lines off the poor executor actually defends on the belly off this x, which really which we are searching in the Senate. So during analysts, often the garden mostly we consider the worst case scenario, and for this example. The worst case scenario is when X is not present in the A or it may be the last element present in the area. They So let's sit anarchists. The bus gets is president for like the element is president. But it is the last element in Delhi. So to search this element for in this any be take a look at the score We see that this formal will run to determine first people search for this than this than this and this. And finally it will search the element for that means if n is the length of very then this if condition will be insecure endowed, EPPS. Right. So in the first case, which is for when we're searching before in our kissed the first guess the total execution time that will be n times my multiplied by see there see is be among off time taken. Do exude this instruction in this condition. So the total time or the worst case in this particular example is en banc See right. So as we can see that the total time actually depends on the length of their If the length of the any will increase the time off execution will also increase. So hence we are able to the line that the time of execution off a program actually depends on the length of very to the time of execution is proportional to relent off the Eric. So this was all about the time complexity factor, which is the most important blank area. By analyzing a particular lord in the coming lecture, we will see another important factor which is under consideration by analyzing the gardens . And that factor is the space complexity, so staking.
6. Space Complexity: In this video, we will discuss about the space complexity. Space complexity is a measure off the amount off working stories and garden needs. That means how much memory in the bus case is needed at any point in the Lord as the time complexity. We are mostly concerned with how the space needs blow as the size and all the input problem rules they. So one thing to know is the term space complexity is often misused for auxiliary space at minute list, so we need to be clear first with the definitions off luxurious space on a space for Betsy Optionally space is the extra space or temporary space used by the bar and space complexity . Often a garden is total space taken by the garden with respect to the input sets space complexity. Those includes what the auxiliary space, um, the space used by the input of in work. Generally. Then, another guard, um, is under execution. It uses computer memory for three reasons. Plus is the instructions piece. It is the amount of memory which is used to store compiled virgin off instructions. Second is the environmental stuck is the amount of memory used to store information off partially executed functions at the time off function got and third is the data space. It is the amount of memory used to store all the variables Constance and structures. So then we want to perform analysts Gonna regard, um, based on experience from the city. Be consider only data space and ignore instruction space as Willis Environment Environment District. Do we ignore both of these? And we consider only the biggest speaks. That means we can call it only the memory require the store variables constant structures except for we're the space from Brexit E. We must know the memory require to store different data type values, according to the compiler, as it depends on the companion only, for example, the C programming language compiler of the C programming language, it requires base to store and indeed a value. It was four base. You'll store floating point value. It requests one bite to store. Collectively, I request six or AM base the store. So this was all about giving you the insights on the space complexity factor for analyzing . Since you appear about the time and the space complexity factors, let us take this knowledge. Former is the upcoming videos off the bulls
7. Analysis of Basic Control Statements: in this video, we look at the basics off analysts is for the common structures, but they're used in a program. So first of all, let's start with a loop. So here in the particular course snippet, we have a for loop onside, the registration off that for Look, we have a statement. A musical too simplistic. So if we have toe analyze for the time complexity off this particular or snippet, So for the for loop each listen is picking this particular Let's say this publicly instruction takes seat day. They This particular instruction is being debated for end times within this particular full . That means this loop runs endgames For each penetration. Seek time units is being utilized order, time complex or if we want to see the order, time complexity that will be equal to and multiplied by C So this is equal to see this is see a on this gun readiness pickle. So for this particular tape off, a simple for loop with each oppression takes constant time. Orel Bankoff Recipe is bagel off. Now let's look at being under sector In this structure we have a Mr you a nested loop names . There is a loop with within a look. So here we can see a for loop is embedded within a Ford. So let's see if this is be out of loop. It runs on the variable I on. Let's say this is the inner loop. So this inner loop is being Mbare inside this outer loop, or we can see it is necessary. This particular look from here till here is Nestor within this look. So, first of all, let's try to find the complexity off this inner, since there is a single statement which Lex Itics constant amount of time, that is C to execute. So for and I'd rations since it grants from one toe end, that means an iterations are there. So the order I'm complexity off this particular inner loop could be de Quito end times. See, right. This in a loop is being the pretty for every iteration off the elderly, right? So this particular I am complexity or we can say this particular time is being taken for each and every iteration off the total, so order iterations for the outer looper. And that means the total overall time complexity will be n times multiplied. But this particular little day. But this will be and see on all it will be and square See on this candidate in s people off and square. So this is a case when we have a Nestor for Luke or basically a nested. And that is the time complexity is equal to be golf and square. No, let's take a look at the third structure in the structure. For despite of your courts, nitpicked we help. Well, well. Look, how be analyze for constitutive statements. So Africans observed that it is a for loop this one, It runs on the variable I and this is a Mr Floor. So this is a nester. Look on This particular is a form. So as we have examined in the previous cases, that for a loop, simple loop, the time complexity or we can still triple time will be If this takes seat change, this will be seeing Alexey mistake seen or so this will be seen or times and on for Mr Look , If this particular statement picks Stephen Payne, when the order time complexity off the nested loop will be see even and split, this is with everything who execute for this, Nestor Thank but this particular for loop on this Mr Looked and continuation to each other . Or we can say they're basically if we consider this as a statement, these two s statements, then these slough on this Nestor loop are consecutive statements, right? So these are mood constitutive. Were there any one after the other, right? So the total time complexity in case off constitutive statements is basically the addition off the individual times off, or we can say addition, off times off the individual statements, that means the total I'm complexity will be seen or end less semen and square, so this will be seen out and less semen and split. So this is a foodie. I'm required by this particular course Nipper in order to execute. And it speaks basically the present in the formal, a simple declaration. We can see that this can represent it in terms off, big, off and square. Since this is a more contributing TEM in this order and complexity. So the total diamonds see not and place Stephen and square on. Basically, we can write this order, thymus. Big off. Now let's look at it. The next structure in this structure we analyzed for, if then his statements. So basically there is if condition and for that if condition. If that if condition is true, then that is a the clerk, then statement. So this is the if statement this is the then statements. If this condition is true and other ways of it's not true, be executed statement. Right? So let's analyze this particular gold, Snip it off if then else stick. And if the no statements. Basically we debated these three parts. So let's say Ah, this particular statement or this particular conditional checking takes seen or on this statement district and true statement takes see one day and it become the else part in the l Spike the store. Look, there's a formal obesity from here. Didn't hear. So here this is another. This in spite is being completed here, Right? So in the in spite, let's say this if condition checking takes, see do pain on this particular statement in this if eggs seafood. So let's first analyze. But if an l statements individually, So what if if this is this flag is equal to true, this particular condition is true than the total time to execute will be seen on best semen . Since this will also be executed, this will all to be executed. And this will also take to the road it and really seen or plus Stephen. So this is for the condition. If are we can say if and then statements. Thank you. And now let's look for the else part or the States. So for else we have basically a formal inside the for loop. There is a condition taking inside. If so, that takes. We have a zoom cito time on if there if condition is true, then it takes See through that. So basically this order takes see too. Let's see today on this See topless city time for it's for each and every attrition off this particular form. But that means total time to execute this four. Look inside the else statement that will be besting multi like that. Thank you. So for the total else part, the time Convexity will be see to the city full times and and for the if part, we have already analyzed that it will be seen or less Stephen Now come stir means that the overall I'm complexity off the if been a statement will be just by the park, which has a bigger time complexity. All we can see, we have to take the first kiss off piece, this one and the statement that means the statement or the particular part, which takes more time as compared to the other thing. So if if been part is greater, I'm taken for president by display later, then the time taken off l spite, Then, despite may be the answer, other ways if animals is done by is less than the time off else part. Then this will be our overtime complexity. Back means we take the larger off these two teams. So here, as you can see, this value is lesser than this way. So this is largely so all time. Complexity here will be just by the else statement that will be see, don't less sickly. And on this we can represented us big go off. And so this is the analyst this for if then else states. Now let's look the final structure, which really consider for big time complexity. Nance's so policy, the logarithmic complexity case. So let's take a look at this particular four simple in this course nitpick. We have a basic phone transport from Icicle. One eyes less than and they But in each particular iteration, this I is getting multiplied by two. In the previous cases, we have I getting implemented by what? But here, eyes getting money, playback, they So for the 1st 8 reason, I will be equal to one. Or the second iteration. I will people to one times two. That will be too. And for the third iteration, I will be two times to the doctor before and soon tell the kids. So I had a particular Kate iteration. I will be for to power on this Isaac will do to the parquet. So I get this. Luke gets exit and so good it completely when I is equal to. And so I get equal to end. That means this end will be equal to go to the market. That means the Kate iteration right to this case, telling us the number of iterations require to reach the spell you off is equal. And that means student of our K is equal Dupin. Or is it a lot? Both sides. So this will be lot to tow. The parquet is he could, you know, do it. That means this will be so K is equal to long based with. And it was the number of iterations. How many times this particular look political? Okay. And for each particular iteration, let's say this takes a constant Seper. So this particular statement XTC time on the total time Convexity will be game will be played by sea. So since K we concluded as law doing to this order and complexity will be C block win or we can write it as big go off block doing like as we have seen that that been in a particular iteration the medium both the inside the for loop gets so multiply by two for each and every iteration then the order and complexity is bagel also like so similar is the case then eyes getting divided by So for the in this particular for Luke for the first hydration , I is equal Dupin for the second iteration Isaac a little and by on similarly here at ticket iteration I is equal to en by due to the color game minus one. Thank you On this so similarly we can do the analysts is as we have been in this particular course, Nipper, and we will be able to find out that the bank complexity here also will be equal to some constant Lexus, even times locked with. Or we can write that again as bagel off. So even if the variable in the for loop gets multiplied or divided, divided by two, the order I'm complexity off that particular for Luke will be off the order. Or we can see off. We can write in the Times off big go off lock. That means people time complexity will be off the order. Logan. Thank you.
8. Comparison of Algorithms: in this video, let's talk about the topic from prison off algorithms, Goodwill workings for it. Us. How do we find out which one is better? No one named the is Implement Boonville, Bardem's and then that done the two programs on your computer for different imports and see which one takes del Este. But there are many problems with this approach, for Annalise is open gardens. First, it might be possible that for some imports first and garden books better than the second and for some inputs, the second Torkham looks better on the first floor, right? So how do we make a decision on choosing anyone? Important is symptomatic. Analysis is the big idea that handles above issues analyzing in a simplistic analysis, the evaluate the performance often Ilg Artem in terms off the input size. We don't measure the actual earning back we can't were. How does the time or space taking Bannon Barton increases with input sites. For example, let us consider the search problem for so Tina viewing item in a sorted it. So we have a sort of dairy with us so and we have to search for a night. So when we do is we do a little research when the order off brute is cleaner on a DUI is to do by any deserts bear. The order of growth is look at me now to understand how is sympathetic analysis solves the problem and analyzing guard comes, Let us see. We don't believe insert on a fast computer and by research on a slow computer. So for small values, off input value, import size and input size, obviously so the fast computer made a less than, but after a certain value, all included a size. The buying research will definitely start taking less time. Ask him, Bad holiness it. It will take more day or largest, not values up. And even though the biases is being run on us so much now, the reason is the order of Clute off buying desserts is Look at me with respect to the import by the order of growth. Off linear search is linear, so the machine dependent constants can always be ignored after certainly leadoff imprecise . So we're more concerned about the increasing a loser for and and we say we have seen that even on a slow machine, buying research performs better as compared to lean a search on a fast machine for increasing a little bit. Or, we can say, for larger values. OK, so it's imperfectly be reduced that bind research is more efficient than the leader set. No. Does a synthetic analysis always book possible? Isn't during analysis is not perfect, but that's the best available for analyzing a garden. For example. Let's see, there are two sorting and mortems that big 100 log in on five and log in time, respectively, on the same machine. Now, both of these and bottoms are Essen critically sane. That means the order of growth. This scene, which is n longer inboard the guests. So with isn't do the analysis the contract on an exact business. Which one is better as we ignored the constants and isn't big analysis, they But you get a good idea if the order of groups off the tool bottoms is different. So I hope you have gotten to your understanding on how we compare gardens by using the isn't Godek analysts
9. Order of Growth: In this lecture, we will discuss a ble order off group. Remember that we started the course by defining in any guard as a sequence off in instructions, independent off any problem in it that performs some useful dust. But actually it depends on the size of the you realize the efficiency off any garden. It is important to understand the growth rates we need to understand how the resources consumed battle garden changes. As the amount off import data gets bigger difficulty, it is granted resource duty off a piece of core in terms of a function. I don't understand the implications. This section look at drugs for different growth trees from most efficient to least official . So first is the constantly off constant resource needs is one where the resource needs doesn't grow. That is, processing one piece of data takes the same amount of time as processing. One million pieces of data graph off such a group. It looks like a horizontal line, so the input and is the if input size of the late eyes end. The real off group is constant or you can say it is expressed in terms off a constant bunch . We're all, will you? Nothin. The second order off fruit is logarithmic radar group A new dynamic growth three is a good tree Build the resource needs grow by bunyan it each time that d days so that this is the resource needs on the input size. Whenever it is doubly, resource needs no back. So if the end is the input size off the data read rate of growth is look at me. That is the laid off group is expressed in terms off a logarithmic functions off the import size. And so this is the leader. But this particular a next this the lenient growth rate. Alina Alina Broaddrick is a group three where the resource needs and the amount of data they both her directly proportional to each other. That is the growth rate can we describe and a straight line that is not Horizonte. So if an is the input size of the data read off, group is off the order and and also you can see that the late off growth is expressed in terms of a lean your foot. So the rate of route is proportional to, and so the rate of growth is expressed in terms off a linear function of the input size. And next is log linear rate of growth a lot linear growth. Three is a slightly curved line. As you can see from the graph, the term is more pronounced for larger values over as compare to the lower values and is the input size of the data. The leg off group it's proportional to and Logan in this case No, next is quadratic Do three. What did the good three is one that can be described by battle like this. So the rate of growth of the resources rose for drastically with respect to be precise. So if it is then criticised, the laid off group is thus proportional in split. What we can see and the reader brute is expressed as a quadratic function open court size. And next this cubicle Well, this may look very similar toe this particle, it actually rose significantly faster. So the laid off growth of the resources que bickley with respect to the input sites, the rate of growth is does proportionally and Cuba here were any of the input size or we can see the rate of the group is expressed as a cubic function, often put size. And lastly, we have exponential rate of growth, an experiential grow three. It's bun. Their growth rate increases exponentially with respect to the input side. As you can see, the growth rate starts off looking like it is flat. But actually it currently shoots a merely vertical ben and close toe. Larger brains. No, that it can't actually working, but it looks like it is shooting nearly party. So here the raid off group increases exponentially with respect to the imprecise. And so, if anything precise, the raid off group is proportional to due to the poet, so it grows exponentially.
10. Cases of Algorithms: in this video, we were discussing the types of illnesses. Let us suppose we have a back off balls with numbers printed only took them and we need to find if a ball with a particular number, let's say seven is present in the bag or not. So this example we will end up seeing either yes or no, but the but to come to the answer, there are three cases which we need to think about. So the case number one is the worst case. So first is divers case support This example. For our first guest scenario, the boiled at number seven is either not present in the bag or it is the last board which will take over from the back. So in order to say so, we will take out each ball from the bag and check if the Bulls has number seven printed on it or not. So basically, we will have to take out all the balls from the back. This will be the worst case scenario, So the second guess is the best case and what will be the best case for the solution? So the boiled with number seven is present in the bag and the first ball itself is be boiled with the number seven. Did you take off from the back? So that will be our best case. Um, the Purkiss is the average guess tonight. So the averages for the worse case. We say that the desire ball is present in the bank, but we don't know which boy comes out, but we aren't exactly. It is seven right to the probability off the ball that number seven is gonna formally distributed. It is uniformly distributor over all the boards in the back, that is, any ball from the first ball till the last ball that comes out of the bag would have number seven production. So this is B enriches scenario, which we have considered so similarly like this example. We have these cases while analyzing and guard First analysis is similar to this is the worst case analysis. So this is being usually the for each and every algorithm. So in the baskets analysis, be calculate the upper bunk on the running time often illegal. So we must know that is that causes maximum number of operations will be executed in order to farm. Find this operable the second is the best case analysts. So in the best case analysis, we calculate be lower bone on the running time, often in a courtroom, and we must know the case that causes the minimum number of operations to be executed, as we considered in the example just dismissed. So the heart is, as we have discussed in the previous example, it is. The average gets analysis, so it is sometimes done for bill works in the average can case analysis. We dig all the possible imports on calculate the computing time for all the inputs and some of all the computing, all the camp calculated values, and divide this by the number of inputs in order to calculate the average case, a scenario we must know or predict the distribution off the cases. Barbie in Port ST So these were the analysts is which we talk about while analyzing report .
11. Asymptotic Notations: in this video. Let's stoppable isn't Dodig notations isn't good. Innovations are languages that when I was two, analyze and algorithms running back by identifying its behaviour as the input size or the garden increases. This is ultimate known as the gardens grow. Three. Does steel garden suddenly become incredibly slow and then precise grows? Does it mostly maintain its quickly and time as they import size increases? Isn't regulation gives us the ability? Who answered these questions? Begin level ah, function oil garden with an a simple regulation in many dependents. Some examples are weaken describing algorithm bites. Best case. It's worse kiss or average gifts. The most common is to analyze it and guard um by its baskets. You typically burn. Evaluate my best guess, because those conditions aren't born, but you're planning for right, so you must always be prepared to tackle the baskets. An example for this is the number Bulls example in the back. It's really so in the previous video. But there are some basic function growth classifications used in various notations, which we saw in the order of blood lecture. Those are constant rate of growth. Does that make the rate of growth Lena Rid off Ruth Quadratic laid off growth on exponential little. The list starts at the slowest screen function from the constant and low Gartman toe. The fast on goes on the fastest greens. Exponential growth since it is the constant and the logarithmic are the slowest. In terms of rate of fruit, they are the fastest in terms of execution. Similarly, explanation is be fastest in terms off green green lead on does. It is the slowest in Dems off execution. So this is slowest and execution Day, and these are the fastest and comes off execution. What is that? As n for the input increases each of these functions, the result clearly increases much quicker and quadratic well, normal on exponential, some bad to go get picked. And Linda, I suppose that an algorithm running on an input of size and thanks six and square last 100 less 300 machine instructions so the six n squared come becomes larger, then the remaining terms since the order of Group Off this dumb is for black with respect to end as compare to the remaining two jobs. So best, um, contributes more than the other terms that is 100 plus 300. If you take as their daughter to this sixth sense work, and they beauts more than this stuff, once end becomes large enough but is going to in this case. So here's a chart chewing values 06 and square. This is so lecturing the little six sense, where on 100 plus teddy under then plus 300 for values offend from under 0 200 So we would say that the running time of this Alberton grows as of the order and square since the anybody about the increasingly lose off and and as you can see this dump becomes faster than this, these remaining dumbs when and is greater than so. By dropping the less significant dumps on the constant coefficient, we can focus on the important bar off Bill open and garden sending. It's straight off because and square anarchists, um, the rate of roses and square without getting stuck in the details that complicated are in the state. So when we drop the less significant dumps, that was 100 plus 300 in our case. So this was less significant. Dumb. Ignore the constant coefficients that is six from six cents where this is the constant coefficient. So if they ignore both of this we get and square Ian Gardens letting back Tuareg artoms running time is in squared. So the bottom line is that we when we drop the listing significant terms on the constant condition we used the isn't or dignities.
12. Big O Notation: in this video, let's talk about the first case and deregulation that is big quantities. Big generation is commonly written as capital. This is an isn't or degradation for the bus gets nasty or you can say sealing off road for a given punch. It provides us with an asymptomatic and upper bowl for the brutal Prove it off, then time off. In New York, bigger is the most common rotation used for going to take time complexity. Now let's come toe the formal definition or this people notice. So by the formal definition, you see if a thin is your garden on Jian is our retreat time complexity. You are trying to relive your garden as a tight upper ball. Been Essen is witness a big bowl off. This is a readiness capital off. But this is big ALOF. This is true. If there exists a real constants C and and not so is that happen is less than equal toe see times, Jim. So this condition must hold true. And this is true for every import size and bit, the end is greater than and not on the sea. Constant should be here, Lindsay. So these are the conditions that C should be given zero and two big eight of them constant and north. Where this condition will hold. This is be blast. It is depicting about the balloon tradition. So in the sciences, we have the date off route off our Elberton. Um, in the x axis, we have the input sized and so we drop trou House bonus or effin, which is the and got me then fine, actually. Gordon Randy on dsi times Jim It is actually be our retreat time complexity. It's been trying, really? So we can see from the graph for this big on rotation case, but floor inputs A's and greeted and not this effin is all this less than and equal do see Time's So this is just like depicting the former definition off big on tradition, that effort is less than equal to see time's Jian floor nd to them and no, no. What do we mean by time? Capable as we have mentioned about tight of a bomb in the formal definition off dignities So which we should be here or exactly, do we mean by thank operable? Let's see, you have $1000 in your bank account so you can see that I haven't amount of money in my bank account, bitches. Not more than a $1,000,000. So in this case, your statement is absolutely true, but not precise. So it would be better or more tighter up a bomb. You could see I have not more than $2000 in my back. So this, if you did this rather than this, then it would be more presents. Okay, so this is like giving a more fighting upper bomb. I would estimate about me bank account beds. No, it's late. This thing and the analysis, Let's see and garden sending, which we do not buy Effin is something like this. And plus four, let's say we assume gin and is the arbitrary time complexity. We're tryingto approximate effort that is also known as the a synthetic upper bomb. Let's Aegean. We try. Don't proximate as in split By this, we are trying to say that this effort will not grow faster than this inspire. I understand the truth according to her definition for data per patient per bone, a century title for ball, that the state as effort is less than equal procedure. So if this this condition bulls true, and this endless for should be less than a little. See dames and split. So if we assume, see, is it going to one elected here then and not equal to three, but intact and equal to three. This and will be like a knock on door for these Johnston according to our definition, this condition. So we can say that afternoon, Bill not grow faster than and square in any case, for increasing the lose off n greater than and not visible to treat. But this operable is not exactly the type or a strict upper ball, as we can even try two room back gin. This can be pulled and also so we can prove this if we can prove that effort is less than it will do. Si Jin. For some questions, see and end North Zach and this is breaded. And so Excel Jian is little enough, So if we can satisfy this condition to find these constant, then we can even have a favorable to Let's try to find C and in North says that this effin , which is endless four This is less than equal to see times GM which is n now, right? So let us make the similar terms together, So this will be four is less than equal to C minus one base. And so if we assume Sequent five here, this will be four tendon and four times and is good clinical 20 greater people before that means and is greater than equal to one that means and not equal to one and seeing between zoom despite for these two constant, this situation is getting through. That means we're able to find some Boston CNN or business remission. It is the same respect that means beacon light happen is equal bagel off, Jim on, Which means this is we got on Gene waas and weakened a f in as bagel off pence. It is bigger if we find a tight in upper bone for run time, often in Gotham. In the worst case scenario, as we are able to go in this exact So this will give as a better approximation off the time , but basically and this is what we get from the big unity's late. Now let's dig in with some examples to clear our understanding off the big on tradition. Let's start with our first example. I didn't is equal t log in plus 100 and Jim is equal. Look, and we have to prove read there. Nothing is equal. Big go off Jian or not, that means began. Approximate this renting three law in Place 100 this standard over ball that is long but just made by this no additional. So let's go by the former definition. So what does the formal definitions exist? The effort is equal big often only if effin is less than equal to see time's Gene Fuller and greeted him. And that means Bassem Constant C on constant energy. What is this condition? No, that's stay put in the batons. So effin is three Logan. Last 100 on. This would be less than equal to see times. This is Jean. Thanks. So if we tried shocking their terms, so this will be 100 is less than it will do. C minus three Logan. And here in a in the bargains we take best to in the law. So this is something like this on the so by the no admit rule, we can see this law based doing our see ministry. So this is a basic rule of law logarithms So this weekend A desk. So this is n to the power See ministry. So this means due to the power 100 who goes here by the basic definition off, this will be a total of about 100 is less than it will go into the power See my history So we need to find some values off n and see to make this condition too. It appears you any photo? Then you can see we have to prove Putin of our see ministry to be getting unequal. 200 So then we can see See anything? Give them the monetary true bigger than 100. That necklace, that means see, should be getting them under entry were identical 230 So let's sort of value off 104 a secret 104 This initially that means you're able to find values off end between the north and disgrace. So, for engaging than to a secret 10 for this condition mint. That means this condition is very true, which is allowing us to say yes. The definition off Bigelow has been make. Therefore we can surely see that effin is Bigelow off June and be able to prove this, but be formal mission on little at medical minimalists. Let's take another example, the big So our second example. Now we are taking emptiness three times ends where that history and swear. Andi in again. We have to prove that nothing is equal order. You can see people off zero. We have no proof this is true or not. Right? So this is our so again going by the basic definition, that is the formal definition off big on tradition do today. So this is three. And swear that this effort should be less than equal to see Time's sees a monster on GM is in here. So make this equality look better. We can say three and square minus c in to be less than equal. And if you take a moment, this will be three in minus C should be less than not in our Lord make analysis. We always have and do you feel and there's all this sport. So in order to make this inequality negative, this part should be less than zero. Since this totally quiet is, let the people to see so we can say clearly at three and minus E should be less than it says that six c should be good unequal three They So here by approximation, If you're assuming this condition to be true, then our C is coming as greater than equal to three. But this is not. This is not a constant. This is a very we're not able could die brother Constant for this boozer pens we can see there we can't find any value off. See, that means there's no paid off constant C and Nor which can sense about this religion they So we can clearly say that is not equal bagel. Jim, this is our dessert. And wanting the North is that we analyzed the algorithms on Lee at the larger will use open that is and your bigoted any little and not. But what this means is be below and not below the values off in north. We are not analyzing our importance. That means we're not here for the record
13. Omega Notation: in this lecture, Let's stop over the second a simple declaration that is Omega notation. So Megan revision is also bonus. Big Almeida notice on it is commonly denoted as by the Greek symbol like this. So Megan Rotation is on a simple degradation floor. The best case analysis. But this innovation is use one for best, isn't it? Or Ah, floor room three. What have you in? But you can see it provides us with an isn't duty. I'm durable for the truthfully off friend and open in the bar. It is used, but we want to say that an algorithm takes at least a certain amount of pain without ruining another ball. So let's start work. The formal definition. For me, the formal definition say's that happen and is the algorithms. Runtime can be denoted as omega off Jian, if for some real Winston's C and N no, this effin is greater than equal to see Time's gene. It is also greater than equal to zero, and this holds true for every input size and where N is greater than and no on. Obviously see is also residency, so this means a larger lose off, and that is a n greater than in north the little bone, or you can see the tank lower bone. Effin is jean, so let's take a look at this graph. So at devices were in depicting the rate off route on the X axis. We're giving the input sites and let's say this is effin. This is See Time's Ian like this. May God deign on the This is the This is giving the under Lord bomb or are working and happen, but and we observe that values before and north. This. There's no particular criteria between this happen engine, but for values greater than and not that means. And this bunch, this effin should be strictly less than equal Do also, this event should be greater than equal do G c times. That means this si jin will act as a isn't loaded lower bomb for this Now, a simple example for this would be if we have $2 million in your back ago. And you can say that I haven't amount of money in my bank account because at least $1000 they so you can see it just accused $1000. But this is not idle. Lower bone for the amount of money you have in your bank. So to be more precise or give even Teitelbaum, you can see I hope at least $1 million in my bank account. This is $2 million. This $1 million if you are seeing is an approximation then this gives us a better idea off the lower bone off the balance. New banker The similar is the case with this primitive tradition which is giving an ace in Gardez durable for garment than think that this No, let's take a look at some examples make understanding here of our Let's start with our first example In our first example, we are given effort That is the garden grant pain as five minutes where and we have to find the asymptomatic lower bomb For this event, that means we have to find a gin sets deck. This effin is all this bigger than equality. Si jin foursome clusters c This is true for any religion and so we have to find this plants and anymore and see So this is by the former definition off we have just discussed be so we have to find B this function do you okay? No, By a title. Lower bowl. That means Arjun. We'll be having a complexity Either equal our lord in this. So let's speak against as Jian mind being people And since it is the next floor in terms of degree, with respect to this happened to let's see if we can prove that genic will end can be the essence. The durable Lord, This right, So next see, for this G in equal to end withdrew on. Obviously this see, dams in should be good than equal zeal. So we like this education as five mins with should be better than a little. See Time's gene that ASEAN on this should be good. This will be obviously with equal to zero since and is always was a Devon. See, we're assuming has been an incredible in a formal definition. So we have to basically prove that five in square We have to find questions seeing in North says that five square is there seeing this for this like this that five months were minus C in It's been producing their state and woman So this will be five and minus e. Is there an emergency again? This pain is greater than zero. That means if the burden is once they do, this dump should also wasn't any spots. That means five in minus C could also be clear that any little you this means and is building. So this is five minutes later than able to see that this means and is good unable to see by five? No, for any constant. See Lexie for even sequel to one. This will be an is greater than equal do when by five. So that means for indeed values that is an or equal Dugan. So after energy, since this is making us and is greater than equal to one by five so foreign to your values and not acquittal bun often this well, you're in this condition will all this That means we're able to find you will lose off concerns at the sequel one and an article one for this relation. Or do that means you're able to prove, uh, this effin is omega off GM Dizzy played and hence our assumption for the title lower as a sympathetic title lower bone for this effin, as Jian is too. And again right? This as an officer so this was our plus exam. Now let's take a look at another example for me. No. In this example, we have nothing is equal 100 plus by. And we have to prove that this is not equal to Big Omega or Amiga off in square. If you have to prove this, we will go by the formal definition off homemade to buy the farm notation off Omega formal definition off a major addition. This weapon on Brexit this is Dean. So this happen should be created an acquittal, See Time's gene for all and President. And so we are basically finally values off CNN North for this condition toe. So this will be 100 plus five will be equal to see Time's Jake that is in square. They no really do some in to do some trick in order to make this inequality simply so as you can notice this 100 plus five, this will always be less than it will do. 100 less finance, slur and greater than equal. Do what? What? Because since for ended in equal, the one we can say five in bigger than people to fight. And we have just introduced 100 on board the sites that means 100 plus files. Best thing will always be less than Equality 100 plus five in provided and it's great that enabled one. So this is a basic approximation. Our basic assumption we are taking and do Go on, go, go! Further impersonation. That means this thing will be less than it will do under five. So every 105 in is good, unequal toe 100 despite on which is great if people do see and square that means 105 in we'll also be greater than equal to see in split here we have assumed that any is did an equal do one. So this one photo where any good since and is getting a little one That means that this positive So we can cancel when and rumbled the sex so this would be under fight is going to be able to see it. That means seeing minus under site is less than people losing when we can see and is less than it will do underside by a seat. But mind you, we have assume and is better than it will do. Well, that means of this condition will hold true. We are supposed we are dependent on this assumption that and should be investigated. People do. But But by our conclusion from this solution off this inequality we're coming to a point that and should be less than equal 205 Bessie. Okay, But that means these two statements are contradictory to each other. That means but even also we can see that by our definition, this relation is true or invaded and north. And by this which is on ended in in North and by this reserve were ableto and is less than equal 205%. That means and also our assumption and is greater than equal to one is in contradiction Buddhists, that means and can or be we can see and cannot be smaller than a monster. Right? So by these contradicted statements, we are able to see breath in surely is not equal Omega thanks GN which is inspired. So hence ableto did I come up to our solution to prove that effin, which is 100 despite it's not a window Omega o in squared
14. Theta Notation: in this video. Let's talk about before. Isn't Oregon oration the devotees? Tita, commonly Greek symbol Tita, this is on isn't or degradation. Do you know the essence of the bomb? On the duty off? Spend time off a number by a bomb? Me that we have found a link time within a constant factor from a boat on below. Let's look at the former definition off this Peter innovation. My former definition effin is Tita off Jian. If for some really Constance Semen, Cito and and North, their semen is bigger than zero. CTO is also greater than zero and also an orchestrated and zeal for these three constants. Condition Old says that semen times Jim is less than effin bitches less than seafood times GM for every input, size and bit and is bigger than and not the basic e. We're going to find out two constants that this Stevens people and then not it, said this about banking. Let's look at the graph also, So in this draft we have rate of growth on the Y axis on the input size in on the excesses . Effin is our algorithms run pain, Andi Semen, gin and Simple Jian these are basically be a synthetic upper bone on. This is a simple little bomb for this effort, and this holds true that it's this condition holds true for every end traded in and Japanese were not bring about what is happening before and after. And not only this condition means this disc condition is only through right. So by this stuff for determination, once n gets large enough, that is, engage with an end north. The running time that is effort is all this between seven Jian on a single gene. Let's take a look at some examples. Let's look at our first example for eternity. You know, first example, we have to prove back it and square less seven is equal to Tita off, Inspector. So we have to prove this. So we will go back the formal definition to prove this. But this is true or not. So by the former definition, if this is true and that means it didn't square less seven and elaborately see even times and square on See people, banks and split on this condition will hold two for all and we live in and no So basically , we have to find three constant semen C two and then nor bits can said despite this condition. Thank you. So let us take it these two iniquity separately. So first of all, take a look at left inequality. So, by the left inequality, that means this one we have seven times in square is less than it will do eight and square plus seven or we can see eight and squared. Plus seven is always greater than people, Stephen Inspire. I am totally you can see that didn't swear. Plus seven, this will be this good agents were right because this seven minutes extra apart from the students were to this whole. With all this, we did that unequal to get inspired on which can apply to this inequality. What's so you can write that? Because it's where is always less than agents work for seven. They that means you can see, see, even is equal. Just this you can take seven equals. Let's take a final if we confine and from here But now so aliens where this gets canceled with this that means and is a positive it we can see this is true for all ended in an acquittal. So for the left, Inequality were able to deny. That's this. Iniquity will hold true for seven, equal to a and for all and the clinical well or we can see any Was it in Egypt and no less . Take a look at the inequality is, but so for the night inequality we have students work bliss seven. And this is less than a little seafood times inspired. No, as we see, what as we saw in the left inequality the skate and squared plus seven in the spirit and age and sport. Thank you so it won't be less than it will do it. Let's take a look this weekend or the take a guess. If we can say that this cadence where for seven and will be less than it could do nine inspire the next, Uh, don't that may or may not be less than this thing. There may not be less than equal to minutes. Well, let's suppose if they try to prove ordinance, but so that s C two will be CTO will be nine. We have to prove that it and square that's seven should be less than equal to nine. This thing should be true, more some values off and at some, but lose off and for like, ingredients. Were we concerned, expanded that I'm not basically we need to find and after from after which it will be only to pray. So this becomes nine is where minus agents were. So this will be that means and square to be greater than equal to seven. And since when is greater than zero, we can write And is there anything? So that means if Cedric went nine this riding inequality it's true for all ended in an equal to seven. And if you take a look at the whole picture by considering the left iniquity and the right inequality port, we find that this whole this whole relation holds true for and in unequal, Since I ended up in equal to one on any ended in equal to seven. So the common parts from both of these inequalities is ended with an acquittal set. They and Stephen it Sito is equal to night unique letter B. Considering Steven Seagal as these will lose, this is true or oil and it is anywhere from seven that means were able to prove like this guardedness Albertans runtime agents work seven is can be denoted by, so we have proof business he does in spirit. Now let's move on to our second exam. So in our second example, we have to prove that Gautam, sometime which is an anarchist, is that cannot be denoted by Peter. Inspect this. We have to prove they so let us plus consider If this happened to, we will consider if any is equality and split, and we have ruled this wrong. They Let's try to prove this wrong. If you have a group distinct so by the formal definition, If this is true, Ben this end elaborately Stephen Things in Split and sequel dames for these constant Stephen Cito on this condition will hold true for all ending benefit. And they, let's consider first this unified in the left anyway. So by the left inequality BC, the end see one days and split is less than equal toe, and since when is greater than zero, we can cancel when in from book, I said lipstick. So this will be since anticipated and zero. This will be seven times and is less than equal to one or and is less than equal to 17 No, By the basic definition, if this condition needs to be drew then and should be greater than equal to some constant and not it should never be less than a monster. It should be true or lose off and created in a constant battle. But here they're getting and is less than equal to invest. Even it is less that which is true for all the use less than this particular value. One bestseller That means this condition can't be true, which means that contradiction.
15. What is Recursion?: in this video really discuss about a very important I got to make a better name that is precocious. So what is the question process in which a function calls itself directly or indirectly its core rickerson on the course warning function? It's called recursive function in a better way. We can see precaution is a metal off solving problems that involves breaking a problem down and do smaller and smaller sub problems until you get a small enough problem that can be sold. Really, then that's more enough. Problem. It's called The Biscuits on the Biscuits is actually build the Rick Ocean families. So in regards it program the solution to base cases provided on the solution off bigger problem is expressed in terms off smaller sub problems. Now let's take an example to make it really clear. So we have a program, then we need to find sectorial often number. So this is the program to find pectoral off a number. Let's see. We need to calculate factorial off. Four. No. One is factory left. Four that this ÂŁ4.3 times to times. So this is a goingto 24. It's a factory. Love. Four Eastern. No let's dig into this example to take me sectoral for So how will this program actually calculate accurately for so we'll call this program fact four. So this will come in under this, Mr. On the biscuits here is four and less than it will do one. And for larger values off end, we calculate by breaking into smaller sub problems, which means for smaller values off and still we finally reach the basket the women see powered. Actually look, as we have said factor in four. So first of all, it is not lying in the basis, so that means it will go in the else case on it will be calculated as n times n is equal before here end times o n minus one it just treat. And again this Factory three which is being called on a for an equal to three. It will again fall in this case. So this may be three times n minus one. So what was end past now that the street two and minus one will be too similarly, this back too little, two times back total fact, but and no, this fact one actually falls in the basis that names and it is falling in and less than equal to one since an equal to one to this will form the basis. So this will be done. But on the multiplication maybe two times one. So this will return this back to well done and done this well done three times to that will be six. Done. This will again return four times six doctors 24. So finally were able to calculate the value of Factory four. With the help off, this precursor picks up. So we see that for larger values of N, we have breaking into smaller sub problems that is, for culturally value of size. End were breaking and do some problems off size and minus one. Still, we finally read the base kiss, which is unless than it will do one for our kids. Now, let us look at the types off Rikers, who are other types of Rikers? Basically, there are two types of others. One is the director person on the other is indirect. Rikers. So what are these types on? What is the difference between these tapes? A function is called direct recursive. It could cause the same function again and again till believed the basis on a function is going in direct recursive if it calls under function. And there's another function caused the function directly or indirectly. Now let's see the core example of border troops. So for that introduction, we're seeing that this is a function. There's a function A and inside the body of dysfunction, e dysfunction. It is again calling the functioning. That means it is a type of right. So Function is calling functioning again and again still be introduced here somewhere in and starting a base case, which is actually released at the end off the record. So this is an example off dead. Now let's take a look at an example of indirect protection. Let's say we have a function A and inside functioning that is a function be and function. There is a call to function to dysfunction, be escort and inside the method off function be be her having a call to function it. That means the function a school again, indirectly, with the help of this function, be so this is as an example off in the extrication. Their function is called itself again with the help of a difference right. So this was all about the basics off record. Now, in the upcoming lectures, we will apply this concept so it's better you read rate over this video if you are still unclear about liquors.
16. Recurrence Relations: in this video, let's discuss about Topic recommends relations. Oregan insulation or any sequence is an equation that is expressed in terms off one or more off the previous terms off the sequence. Let's say, for example, we have a sequence off natural numbers like one Do Me, and so so any time in the sequence can be written as the sun off its previous stone. And but so let's say we have to compute the second time. That is a to just do here to that will be even. That is one that's one similarly, a tree and wilderness it to this one and soon like this. So finally we can write and is equal a off n minus one last one and is the anthem on N minus one is the end minus one of them? So this is basic, reckon insulation, where we are using one or more of the previous storms really mind the next time. And this relation is true for all invaders in with n Greater Than and Not on. And not here is a non negative integer, which is equal Do well, thanks. The regular installations are basically used to determine the running time off recursive programs. We're taking an example off recursive program for calculating X to the power and elect be in with time require to Seoul problem. Oh, size and on the base kiss here is for an equal to zero. As you might remember, that base case is bare the ricker shin ends and we know the solution for that basis. Now how we know the solution for this baseless. So this is any n equal to zero and equal to zero means the exponent is you and we know exponent zero with a bit with any basis. That means let's say you don't have power. Zero are treated treated the power zero or any number Any natural number to the power zero is equal to one. So this is a solution to this case we already know. So this will be the base case for our solution to calculate extra the bar And so the time require to solve a problem of size zero that is still zero this be already know. But this is known to us. Thank no. Let's quickly betrayed over this example. Explain to explain your eyes the working for the 64 this particular, you can't put the power off extra department, right? So let's say we have an example fighting about three. So if we call if you want to calculate pi to the power treatment by dysfunction will call Call this dysfunction dollar based despite and power history since antiquity three here to this will not fall in the basis through it will go in the else case Very well written. The multiplication of X multiplied back power off X coma and months. That means this is something like five times the value of going back going to power function basis. Fire again on the power is which is one less than the previous. So as you might know that fighting the power three you can write us multiplied by five to the power. So that means calculating a solution off site and breaking the dental. My application off the number solution off size and minus one. So let's break it for this will be five times smaller. If I come back to this, this function called again, go to dysfunction on air and equal to two, so it will not again fall in the basis. So it will goto this else case, it will be five times parlor. Fight the movement and again, this will call this function. Andi is not equal to zero triple again. Go in this else case until ridden five times dollar off now it will be reduced by one earlier. But that will. That will be fine. Common seat not This is our biscuits an equal to zero. So the irritant by this conscionable that will be but right. So this will be finally five times one that will be fine. So the value intento dissension boil the tackle despite Similarly, this week this whole building five times file that will be 25. And here also this will be five times the value returned by this function, which is 25. So that will be one going to fight finally were able to find Try to the power three by the function courts on this function. Call stack is a tube with the process off Rikers. That means for solution off size. And we're basically multi plane. Be based in calculating a power that is eggs times the solution off size and minus one. So this is basically an example of repression which were using You can't look the power. So now, since the working off this program Mystere let's spoke us on the line in the recurrence relation for this is a first of all, for the basis honesty off zero. Let's see, semen is the time off computers in for the biscuits, the sea off zero that people do see. But in other ways where any well, you end CNN will be this bank require Compute this. So when operation is the multiplication operation on the other operation is to calculate the time require by the solution off sighs by this stuff, or you can say sub problem off size and minus one. But this may be my legs, time required and multiplication of these two values takes See today the PM will be C to les time required to solve the same problem. So this will be deals in Minnesota, since size is reduced by one. So this will be tee off and minus. So if you write in a better way de in Britain, semen then and is equal to zero and c do les de n minus one been in this presidency. So this is the recurrence relation for the about recursive box
17. Let's Divide & Conquer: divide and conquer is another very important Elgort in the reading bunker approach. Problem in hand is divided into smaller sub problems and then eats a problem. It's soul independent. Can we keep on dividing the sub problems into even smaller za problems? We may eventually reach a stage. No more division is boss these Atomics small lists of problems. Our fractions are then sore. Then the solution. All the sub problems are finally immersed in order to obtain the solution off the origin problem so broadly, be, understand, divide and conquer paradigm as a three step process. The first step is the device step this step and balls breaking the problem into smaller sub problems. The Sir problems should present a fire off the or Israel problem. This step generally eggs and recursive approach to divide the problem until no sir, problem is further divisible. At this speed, some problems become atomic in nature but still present some part of your troupe. The second stage is the conquer state. In this step, this step actually receives a lot off smaller sub problems to be sold, which can't be broken further into smaller problems. Generally at this level, the problems are considered soul and on their own. The third step is the combined stick and the smaller sub problems are sore. This stage recursive Lee combines them until the formula. The solution off the original problem This government approach books Rick personally and conquering merge steps books so close that they appear s one. So here we are seeing a chart which describes the divine in Congres Porte. Firstly, we have a problem which is being divided progressively into smaller sir problems. So this divide step is being then still the same problems are off atomic sites. So this is divide step. It is the first on this step is being done till the sub problems R us a. Dominant says now. The second step is that these atomic sized some problems I sold in the contest. So this is a solution off this smallest atomic sized problem. Similarly, this is the solution producer problem. And so so finally, the hot be happiness in the 2nd 2nd States that is the congress step. The solution toe all the smallest sub problems. That is the solution to all the atomics of problems. And finally, finally we have with this footsteps. It just pick combined step and in the combined step be grow the solutions from the atomic sub problems Duda paid in separate. That is when we broke here from this a problem toe This this is a problem. Let's say these are the atomic sub problems. So then become mine. We're going but little back from here to hear this dissolution is the solution to this separate Similarly, this solution a solution in the separate and like ways be combined all the solution off the sub problem step by step in order to find the solution. This means so this is the third step, which is the commenced some important computer and artoms which are based on divide and conquer programming approach. Those are March sort week sort and buying illicit. So these are symbol be many bargains which are based on divide and conquer. And of course, there are many more
18. Solving Recurrence Relations: In this video, we will be discussing methods for solving recurrence relations. There are many tree bees for solving recurrences of this matter is this substitution method in this matter? We make a guest for the solution and then we used mathematical induction to prove that our guests for the solution is correct or not. So the second mother is the recursive three mentor in this matter. We draw a recursive precaution tree and quickly time taken by each and every level off the tree. Finally, we some the bourbon at all levels to find out the time. The third matter is the monster method. No monster matter is a directory to get to the solution. The master method only works for a specific type of recurrences. Recurrence is defined by de en is equal to eight times D and by B less ever been where is greater than equal to one and B is greater than so are mark. Master Matter is applicable for references relations off this type or two types which can be transformed to this day. So these are the three methods between were discussing in the lectures to follow for solving recurrence relations. Stay tuned
19. Types of Recurrence Relations: there are three types off recurrence relations based people discuss in this lecture is dividing Conquer Rick installations. As you know, in divide and conquer approach, we solved the problem by breaking the problem into two equal PSA problems and then recursive Lee compute for these PSA props. So, in order to compute for the two equal sides, sir, problems the time required to compute those problems will be PM by two. And since they are closer problems to the total time required to solve the problem of science tea and will be two times the endless to and some extra time in order to come by in the solution to this to support. So the example for the world in Concord reconcilation type will be somewhere of this type. Honesty often is equal to two times t o n by two. Bless seeing that is the time in order to join these who's to sir? Props on the Type two is lenient recurrence relations. Example of this type is Ian is equal to p. O n minus one lesson not here. The pattern is like in order soil a problem off safe, and it depends on its previous some off previous terms, which are different by Alina. Difference since end minus one is different by a difference off boy or we can see any other example like tea and is equal to PN minus two less it. Also it is different by Alina difference. So these type of reconciliations are all leaning recurrence relations. Now the third day is values substitution before solving. Sometimes reconciliations can be directly soul using techniques like substitution recurrence tree our master metal, as we have discussed before. Therefore, we need to convert the recurrence relation into appropriate form before. So, for example, let's take this reconciliation. This is Stephen is equal to p o square root and less one. As we see this reconciliation is not looking familiar to us in terms off solving by substitution Bricklin Street or the Masterman. So you sold this type of recurrence, be habitable, some substitution if we substitute en equal to through the power and in this example, we see that and is to do about them to this will be a key off to do the power em, and this will be he off the power and and square experience will be borne by toe So this will be put in power and by two less. Where now let's assume be off to the power. And is I saw him. So that means he off loaded of our Mbai to this is this expert in December. Similarly, it will be s off Mbai. Right? So now let's substitute here. This will become s off him is equal s off and by two less Now this reconciliation is often divided incompetent That is off the paper and this can be sore. But the master matter is a so we have done some substitution in order to Seoul this type of rig loose village the divide and conquer recurrence relations These type of recurrence relation can soar using monster mythic the linear reckon installations. These types can be sore using this substitution mint on the value substitution before solving. This depends on how you apply the substitution as not case. We applied the substitution and finally got this reconciliation. It can be sold using the monster Depends on what substitution. We have to be a black in this this type of reference which so these were the three main type of reconciliations Ritual mostly come across by analyzing any Albert
20. Substitution Method: they're mainly three. Lease off solving recurrence relations. In this lecture, we will be discussing the first point. This substitution substitution method for solving recurrences is famously described using two steps. First, we guessed the form of solution by didn't really matter. In the second step, he used induction divided our assumption that our guess is really on. One thing to note that this matter all these books in solving recon insulation off any day . So whenever you're stuck in the memory about any officer solution or cylindrical insulation , you can use this substitution method. Let's no loan. How will play the substitution matter to solve recurrence relations? Let's dig an example. So in this example, we have reconciliation, something like this, that the steel Finn is equal to two times be off and by two less end. So going by the substitution matter, we have two steps. So Step one is guessing the solution. So because the solution by it in trouble method So let's say first, I guess solution as Ian is equal to big open Lipsitt. Okay, so this is our guests and we have to prove, but if this is true or not so in the step to, we will use mathematical induction proof back. This is true or not, they So if you assume d N is equal to big off, and then we need to prove that by the formal definition of bigot notation that he off and should be less than it will do. CNN for oil and president of Constant and North District For all the people on this sees a constant right, as we have discussed in the definition off begun English. So by the artists off the recurrence relation, as we have in the example Let's strike do put this value and we are just So If devia tion is less than equal to see in then e off end by two, similarly, would be less than equal to see Time's in back. So let's try to find out being by putting the value of P. And I took it so being in that kiss will be equal to old names. Number this steel, then may do as we have used the notation. So we have, find or detect. Ian is less than acquittal. Seeing Michael. That means the standby does less than equal to see in bed. That means the steel will be less than equal to base. See off in my as we have put the value here less and thanks. So initially it was equal. But since Deion by two is itself less than equal to see and by two So this Ian would be less than place, See, And by yes and okay, this means he and his less than it will do See off and three times, And that means being is less than equal to see and pleasant. But this see and listen is greater than the scene. So as we have a zoom in, our guests that begin should be less than equal to see. But it is greater than seen from this as we have put the value of P and by doing this and we'll finally find out that Ian is created and seeing. So this thing is residency, which is a quantity cheap fluorescent. That means our assumption being is less than equal to see in Oregon City and physical Bigelow. And this is this is incorrect. And this can be the solution. So our guests is drunk, so we have to beat the above two steps. The step one and Step two again for any other guests to find the solution for this reconciliation, let's start the another guests for this reconstruction and next in high order. With this end, we have and Logan great. So after and big a guess as bigger guests as Let's Sit in is equal to Bigelow off and longer. Now let's strike. Prove this in the step to the use, the induction or a method you can say method of contradiction. True, but Lestienne is equal to Biggles and Logan or not. So since T invisible toe against the off in my new place in and by the former definition, we have assumed speed is able to big off and Logan that Weinstein should be less than in Quito. See, time's and look and as we have be invited, come also. So we can. I mean by two this form. This will be less than see Time's and by two Lakoff and by two thanks. That means being by two is less than equal to see times, and by who so anyway. So let's try to form the scientists from this, So this will be two times be end by two. This will be less than equal to my deplane. You'll hear this will be seeing no and by two and you'll air and also so this will be n plus to be and buy two. But this will be less than people to see and and by two less. But this is our images. Thank you on Let's simplify this part. So this will be seen now by the basic rule off logarithms Love em by and physical too long and by this log and so this will be seeing love and minus seeing law to less. And now this is lobbyists to write. So this longest to to this really? But finally this comes as CNN love to end. I'm writing the base now, so this will be locked to end minus seeing less And the heroes of the law based waas they No, you can take a look that this is less than equal to If I did more noble, more battery So let's take out in common from this. So this will be minus C minus one times. That means this thing this Orel thing is less than equal to see in law went since something is getting subtracted from seeing a lock to win. So that means this whole thing, this thing is less than equal to CNN law and and that's what we have to do. Fair. Yes, that means we're able to today or were able to prove that peon. It is less than equal to see love this too. That means, I guess, that the in is equal to big off and lock in this today, and hence we are able to derive the solution for the slicker insulation by this substitution.
21. Recurrence Tree Method: in this video, let's talk about the other matter for solving reconciliations that is a recurrent stream it for in this matter be undergo three meters steps to find the solution to the reconciliation . Firstly, we draw a recurrence tree for the recurrence relation that is given in the question. And the second step is Calgary. The time taken at every level off the tree, the tree which is the recurrence tree, which we have drawn for the Reagan installation. And finally, the some of the bargain at all the levels to find out the total time off the gardens that your Children time off work. So in the first step to draw the Lignin Street, we start from the human recurrence and keep drawing till we find a pattern. Among the levels pattern is basically manipulation or a jointed progress. So, for example, let's consider a reconciliation in is equal to in by four les de and by two let's see times and square. So this is the given reckon insulation. Let's try toe, make a tree out of this reconciliation. So, basically our newest to fine Dean, this is given in the form of this right inside this can be grown in the form of tree as C and square and the first brunch as the standby floor and the second lunch as a teammate. No, by the branches have these domes because the systems P and buy for Indian by two can be constantly break broken down to form the next level of branches. So that means the guns big spot we have assume at the root on de because Rick cancellation terms our assume our believes us. He's been further open to form the remaining part of the tree before the break down, the expression the steam before Let's start right this Tianwei from before from this given English. So if we assume and as an before here so this will be de and before he died before that little bitty and by 60. But this is me and by 16 LST and by eight bless, see and by full thank so again, as we have adopted the criteria for right in the tree for this particular being similarly, Villa dark 40 and by four and being better, right? So let's break the steam before to this day in before can now be broke the next it can really see and by four words were so this would be C and square by 16 and further it's gonna be broken as Julian's as he and by 16 on the other. Reitman the right journalist. The end of it, Right? So we have a place to stand before back this thing and similarly little day he invited. So I hope you can write the standby. Do yourself from the even little insulation. So let's like this. So that would be He and I do is equal to De and by Dubai Ford activity and by a LST and by four let's see and by tools were so this will be see and sweat full. A similar legal right in the similar fashion. The stay in battle in this special. So this NBC and sweat by four and the left front's will be tea and by eight. And the right branch will be being back for thanks like ways we have to bring down further this street big don't for the you can find out that the street is something like So this is a level two and if he again tried toe, find out these good news from the given reconciliation, the tree will further break up something like this. So this will be see and swear by 2 to 6 this will be see and square by 64 similarly, 40 in by eight. You're right this as C and swear by 64. So this have free computer you can yourself try to find out is the use so on the street will be so you don't don't have to compute for all the levels You basically need to find it back in. So as we have drawn three levels, we will try to find out what type of president as we have discussed that there might be an ultimate progression or limited permission. Pick me all the levels between the some four. Let's right there wouldn't know the value off tiene. Basically, we need to help some of the three notes level by level. So for the first level, we have some as C and split on the second level. We have seen swear by 16 Betsy inspired but this is finally see and square by 16. Similarly, for the third level, if you try to find out will be don't defy see and sweat by Gulf of Physics and soon we confine. So be in can believe in us. See and squid less five C and square by 16 less 25 c and square by 2 56 less so to good people. Relations This what type of pattern is this you can observe. So this is a geometric progression where the common ratio between the terms is fine. My 60 That is, if you divide this time by the system, you have five or 60. Similarly, you divide system by distance, people again get 56 That means this is an in finance cities romantic promise. Thank you. So you will basically consider it in finance values on this is a limited progressed So the some off a demented relation for infinite terms, that is, that is a oler when minus Yeah, So this gangrenous is bustin over one minus Know what our artists find my 60 but this is 11 by 16. It just equal 16 16 by 11 CNN's where Thank you Pian is equal to 16 by elements see in sports. So this is done Did a nest This can greediness bagel en suite as you can find out a menu where this is less than it will do some seed to inspect or C to greater than equal to 16 seed by 11. This will, right? So that means you can die. Neil Finn, Ask big go off and square. But you are able to derive from this little in ST relation hence able to derive the solution as Dean is equal to bagel off and swear by this irregular in ST approach.
22. Master Theorem: in this video distractible the third method for solely political installations. That is the mustard tournament. The monster to a matter is a daddy on a genome. We get to the solution, the master matter. But it's only for specific type Africa installations or reconciliations which can be transformed through that On that campus. Deon is equal eight times the end. Baby, this happens India constants, and it is always created an equal one and being this big. So if such is the condition on this is a recurrence relation, then you can go on. You saw a lyrical installation by the master turning so in mustard total method there are basically three cases. Bus kiss is if this effin is equal toe Peter into the power See bear See is less than love is B a n b are defined by Constance Sofaer sees less than Lopez beer. If such is the case. Ian is, um, Bay pita into the barber. Not this Be to this low. Bisbee is in the power of this and they So this is to the power. Love this be. Thank Now. The second guess is if FN is given us. Peter ended about see this is equal to don't be. Then Deon is given by Peter. Ended up our see Logan Finally, the third case And the purpose is if effin is equal to Pita and to our C The sea is greater than love is being been. Ian is given by Tita off effect. So these are the three cases now you guys don't need to memorize be about formula. Just you need to remember the reconciliation on which the master could, um, gets applicants. Okay, so this is the This is consolation. And as you practice on such type of freak insulation by listening to these, this is you're gonna be Ben. Burst yourself for the solution off each is no. Let's 62 examples. We help you understand the master to them better. First example is Deion is given by three times tiene by two less in spring. So let's find out. But that this reconciliation is off the tape that being discussed in the muster to him. So in the monster term, how reconciliation Ian is given by it comes in by b blessed happened. And as you can see from the stricken insulation that this is somewhat this type of That means we can a black the master to him to solve this sick installation So OK is equal to three is equal to two and f n is equal to any square and square this weekend, right as pita Oh, in split. So in our case, is we die? If effin is equal to teach off into the policy so here is equal to effort is equal to Peter off and square. That means C is equal to do you right so is equal to three physical 22 and season No kisses . You find out no best being so first will compute based B A This would be no based to three on this base to three is always less than the base to for right And this is nothing but this is stupid and we just see that means see is good long base to three or you can see it is bigger than along this So c is really little base B. That means which is the kids. It is the turkeys. So this is satisfying the turkeys to this in place that no begin c by the monster to room Deon and greediness Paedo. Nothing. No. What is effort? It is equal to and split they So it is a fitness and sports they so he is going to beat off . But this we have a team by a big kiss three that this is absolutely Let's take another example for mustard. So here now we are given teen is equal to four times stand by two plus n square So similarly as by the first example people try plus but that this is the time as we have discussed in the master to him or not So the monster to him is somewhere else Somebody applicable to this type of reconciliation and you can see that you can easily let the given question. But this reconstruction that means you're gonna black my system to solve this reckless foolish So is goingto four from this beena is equal to two and f in is given by in squared . All right, so going further, it will help late best be so long. This be a This is equal to long based too four which is equal to that needs. See this longest be Is it going to and see from this effort is if f in is it will do feet up into the varsity. So no, my mind that this end square can believe in this Pito and square. That means Evan is given us people into the power See their season. This means seasonal too long. PSB is again tickle toe to that. So this in place that you can see si is equal to love this be so. This tells us that Beacon defer to the case to or solution solution off this reconstruction on by case to if f physical to Peter and about C on seasonal to love this beer then Ian, it's given by Peter off into the powers See, which is to long That means being is given by Peter in Split long. And this we have a team by the is to off the mustard. So this is our second exam. I Let's take another example. In this example, Ian is equal to 16 times t off and by four listen, the festival let's try to relieve, but that this is all the time for solely the master term. So in Moscow to be considered this type of frequency So as you can easily late that this type of recurrence relation is Annelise, do this. This one so we can apply the master term here. So if you play the muster to him, is it going to 16? B is equal to four. And if in is equal to and so Evan, get on Toby. Readiness, Tito. And so see, in this case is equal to face. So seize a good one physical before and a school 60? No. Next we will find out the value or log based B as it is needed in all the trickiest The law based B A. This is equal to LA based 4 16 on this value is equal. So long best be able to and seasonal toe. This means see is less than no this be okay. That means the first gifts is being said aspire So this is thickest and by paceman effort Physical Peter into the power See and sees less than love is being been. Deon is equal to Peter off end of the father Long best be Remember, this is in the father. So this is equal to a lot of this being from here. It isn't going toe, so this means pita and split. That means Ian is equal to Pete, though. Oh, in squared. And this is the solution. Do our regular installation by. So this is by use one. So we're able to compute even that s t in. It is equal to teach off Ensler by big case one. So this was our hurting some to numb. After practicing the other examples you might be having an idea on hope will play be mustard. You can also try your hands on some other examples to Monster monster too.
23. Master Theorem - Examples: in this video, we'll discuss some examples off mustard room. Our first example is the reconciliation is Neil Finn is equal. Do three D and by three plus Rudy. So in mustard took him. We have reconciliations off the type. You often is equal to a d and by B bliss improvement where a is greater than it would want on B street even. And we see in the about reconciliation It said this place or that required conditions, that means we will a black no master. So we have three cases, as we have discussed for Master. So here, let us strike. Right. The values off a the NFL so is equal to three. Basically three again and f in is equal to gluten are weak united better as n to the power . Right? So every no baby, no on f open, you know, so we can apply in them thes. They're using the guests. So we see back. Plus, we need to get her long. Bisbee, The lot Bisbee is love makes 33 That would be, but on their effort is equal to two Peter into the power. See? So this ended about house gamble itchiness, pita off into the house. So that means effin is time to the powerhouse but just ended the power. See that mean C is equal parts on no base B is equal to one. This means Law based B is greater than see or C is less than loggers be. That means this falls in the first place. And for the Huskies solution is do you often is equal to Tita and to the power longest be That means being will be no Tita n to the power. A lot based B is equal to one. So this will be into the power plan, which is nothing. So this will be Pete up into the color cleaned up and about one it will be Your answer is so this is our plus six. No, let's moon worse next. Next example. So our second example is the often is equal to when fight e n vital lesson way. So if we compare with the rig translation off the master's room, we get it is equal to point face. Be easy. But this to on. See, we just Tita into the policy. So effin here is one man. It just ended the butter minus one And this can be readiness Pita Oh, and the bottom minister, that means see easy. But what they So it's easy to minus one. No, si is equal to minus one is good two point fine and visible. But remember, he stated that in mustard room it is greater than equal to one on B is greater than one. But here is not dealing on equal to one. So is not set. Displaying the criteria for the master term to be a black That means by mustard to him be gone Solve this reconciliation So there is no solution by mustard or we can see monster to him gonna be applied to this particular recurrence list. Right? So we kind of play the master term with this particular recurrence list. This is an exception. Do our normal slow off, master right now let's say our example on my sitter. Our third example is a little complicated on our ignorance. Illusionist do you often is equal to tee off Juden. Let's see and we know that master to them is applicable on reconciliations. Off type do you often is equal to heels The end by be less effort But you see that this particular recurrence solution is not off the same day. So we have to do some substitution or some modifications in order to convert the stricken insulation. Do this pretty so we will see how we will do that. So in order book and work district insulation in this day, let's say we assume and is equal do do do about him. So we will see how this gets transformed into this particular little insulation. So if you play to the power, um, in place off end in this circle insulation, we get deals due to a power em is equal. Do not This is ended about house. That means to put it about him and all of this through our house. It will be to list to the color Mbai do on. Of course, this will be see. So no, there is something. If this is the off for a problem of size M, this is for a problem off size em. But we are getting a little notion off something like this, right? So, you know, I did in a better way. Let's Sylvia Zoom s awesome is equal to deals to do about and So now if the substitute Mbai to hear this means as off em by two build me he did about M I t name. So let's applied this substitution into the segments list. So this means Esselstyn is equal to not This will be a self em baby. So this will be s off em by two. Let's see. And no, we can easily relate this party political insulation. Dude, this state, we just for the mustard for him will be applicator. Right? So we have done some modifications in order group on this complicated looking reconcilation into a family looking frickin stage. No, we can easily apply the master's room into disparate political installation. So here it related with the stricken installation A is a good one on B is equal to two and s 11 is equal. See, which is a point so constant can bitterness and to the power zero. Since this isn't quickly went on, this fool can return us Tita off into the power. See? And if you relate with the cases off monster term, we see that C is equal to zero. That means is he going toe? One musical two and C is equal to see right. So let us not get longest be. It's a lot. Best be will be no based Do on this again will be That means long days B is equal to see which falls under the second guess That means we will apply the solution off the second guess So by the second case, we get no here. The solution will be for s and not being right. So for the first step, we will like s him will be equal to Tita ended the policy and C is equal to zero Logan. Right? So enter the bar. Zero is nothing but plan to This will be teeter off lock or sorry. This particular vehicle insulation isn't that very well am. So the solution will be in terms off money. This will be important policy along. Thank. So this will be Peter Lowe him on. So here also, this will be effort. And since the variable is and one day right and here also will be Now, since we have found the solution delivery able m let's take it back in terms off the Orenstein variable. And so it they look at our substitution. So this is an Izabal due to develop them. So a 50 love What saves Not missed two would sex. So this will be longest too. And that means a musical. Don't look this too or no, we can like this s this s autumn is equal to P off the him and what was due to be off little about him that was equal. Disney's Dolphin gamble you Dennis Heat though off law M and what was m. M? As we have founder, it is equal to longest to it. So this is law off law. This too Serbian. Finally, we found out as pita coleslaw. No base to it. So this is our answer. So what we have done is we have used some substitutions in horrible flushed can where it ended up, Stamler, time off, reconcilation where we can apply the master term. And then after finding the solution in terms off a new variable, we changed the very new variable again in the in terms off the old very Hence we find a solution to this particular reconciliation. So this was our turn exam