Sir, you are not audible, sir. Hello. Now, I guess I'm audible. Yeah, you are not audible. Just give me a moment. I'm just starting. Okay. My voice is clear at now. Yes. Okay. Okay. Actually, the wireless mic that I'm using is charged, I guess. Okay. So some noise will come. But in a minute, it will be charged. Okay. So in the In yesterday's class, we started discussion on the first property that was monotonicity. So what was the basic agenda here was similar behavior throughout. Means that if something is increasing, it will increase. Okay. And if something is decreasing, it will keep on decreasing. Okay. But when we talk about the algorithmic complexity, so monotonically increasing functions are quite popular. because we know that the algorithm, if the input size increases, so obviously the number of computational complexity will increase side by side. So monotonically increasing definitely will appear in most of the cases and we can easily determine the computational complexity. Then we talk about some strict monotonicity. So strict means that the equality sign basically we are removing or we are saying that at no point of time to value u and v are equal okay so the function like wise here is stricter we are we were saying m and n to value we were taking so at no point this m and n are equal so that equality or that strictness we are introducing here next part is uh next we talk about the floor and ceiling well so floor is nothing but the greatest integer less than or equal to x. So x will be definitely a real number. A real number and we have to identify the integer that is close to this. So that is a floor representation. When I talk about the ceiling representation then I will try to identify a real number that is just greater than or least integer greater than or equal to x. So let us say this is some x value that is a real number. Then we have to identify floor and ceiling likewise this okay so then these are some properties that you people can refer and then we talk about the this example where we try to obtain the floor and ceiling value okay so in case of positive number in case of positive number floor is floor is the integer integer part of real number real number okay and ceiling is next integer for positive number okay and for negative number the property chain so the floor ceiling is the integer part of the real number and floor will be the next lowest number in the series let's lowest number in the number line okay so that is two important thing that we have to remember now let us talk about an important property that is called as the modular function and arithmetic or modular property what it says in modular or mode we sometimes say mode of so what we try to determine if i am writing a mod n okay if i am writing a mod n so basically what i am targeting when i will divide when i will divide a by n then what is the remainder what is the remainder basically simple idea so in our childhood we have did division like this so a is basically divided by n let us say it goes m time okay and here we are getting uh some value uh let us say b here it will be some n into m minus so what basically we are doing a can be written as mn plus b. So this b is the mod of value operation. So mod means that just to identify the remainder that will be coming out when we are dividing a number a with number n. And in general here it is written k equal to mq plus r where k was where k is identified in terms of mq plus r where r is the remainder and that we try to determine that we try to remainder that we try to determine okay so here are some values written so let me solve some problem 27 25 mod 7 okay so if i simply do like this like what what what we are doing childhood so 7 will go 3 times 21 will come 4 so 27 5 mod 7 will be what definitely it will be 4 next problem is written 25 mod 5 25 mod 5 so it will be what so basically 25 5 goes will 5 time 25 and remainder is 0. So here we are getting a 0. Third example here it is written 35 mod 11. So what will be the value? So basically 35 11 will go 3 times 33 2 will be the remainder. Okay. Similarly, we have next example that is 3 mod 8. 3 mod 8. So same thing we have to follow, but here if you see the number is smaller. So what basically will happen? 3, we are trying to divide the 3 by 8 and we know that we have to identify the number that is located here should be less than the existing one or equal to this one. So it will go 0 time okay and here 0 will appear so remainder will remainder will be 3 okay so that is important part this one so um for those who are i guess who are aware of this mod operation this is fine for those this is new just every time try to draw this okay let me do some more complicated one minus 18 mod 6. So in this case, the remainder will be of course 0 because here is minus 18. So 6 will go for minus 3 time. We are getting minus 18 plus and then this becomes 0. Now let stick some challenging one minus 17 mod 3 what will be the value okay so if you directly solve it without solving this kind of thing so what will be the value e3 will goes uh five time and the remainder will be two that is a simple idea but this is wrong let us check why so minus 17 3 so how many times 3 should run 3 should be run in such a manner that it will be equivalent to this or less than this so it will go for how many times it will go for minus 6 time so we will get minus 18 and we know that here there is already existing minus so it become plus 18 and the resultant will be 1 so minus 17 mod 3 will give you a result of 1 rather than giving minus 2 okay so this is kind of assignment let us minus 29 mod 5 will be what and minus 7 more 2 will work so just estimate this i will check in the chat and then i will solve 29 mod 5 minus 29 mod 5 and minus 7 mod 2 29 mod 5 minus 7 mod 2 so uh may be possible this is looking so uh now but this is the best way you will never make a mistake while estimating the mod thing let me check the chart one and one okay good someone is saying 10 or maybe possible he or she want to write one one and one okay great so uh so i guess uh because this uh this negative mod is occasionally asked in in your exam and probably you will also get one in the quiz okay so i guess you people are getting what i am conveying so let me solve this then we will go ahead okay so 29 mod 5 so 5 will go for minus 6 time and result into 30 so of course the output will be what 1 and here also it will go for uh 2 will go for 4 times 8 and resultant will be 1 and 1 okay so that is easy to go but the thing is you have to just draw this okay though it is quite nav but you should draw it okay now based upon these uh modular function arithmetic there are there is one famous property that is called congruent property so here if you check a mod n is equal to b mod n means that the remainder are here r1 and the remainder here r2 are equivalent okay when two numbers are being divided by same number if you can check n and n we can write a is congruent to B mod n saying is equivalent to B mod n. Okay. And this is, if this is there, then there is another property that is a is congruent to B mod m if and only if m divided b minus a. So, if I say a mod n is equivalent to b mod n where n, a and b are what? Are integer. Okay. Then we can say that a is 1, 2, 3 congruent to b mod n And if, this is possible that we can say that if and only if, what will be the value that is b divides, here m is written, you can use n because the symbol will remain same, n divides b minus a. So not b, it is n divides b minus a. So let us take an example to prove this congruent property. I am taking, one important thing is that here I am writing b minus a. So to ensure that this is there, so means that this should be positive. I will take higher value, but you can also take a smaller value of b and larger value of a. So, I am taking 11 as a and b as 17. Okay. Now, n as 2 I am taking. Okay. Because if I divide 11 by 2, then remainder will be 1 and 17 by 2 then the remainder will be 16. So I do 11 mod 2. So basically I am doing like this 11. You go for 5 times 10 will come 1 will be the remainder. So 11 mod 2 will be 1 similarly 17 mod 2 will be how much it will be also 1 because if you do 17 with 2 so it will go 8 times 16 will appear and 1 so both the modular values are 1 or we can say that a mod n is equal to b mod n okay now this will hold if and only if b minus a that is 17 minus 11 should be divisible by n or that is 2 we are taking. So that is 6 by 2. So we will get what? 3. And when I say something is n divides b minus a, this means that the remainder should be 0. Okay. When I am saying n divides b minus a, so this is Basically, we will get 0 as remainder. So here we are getting 3 as quotient. So remainder is 0. Or simply if you tick, it will go 3 times, 0 will come. So that remainder is 0 here. So this property is called as the congruent property. when we have three integers a b and n and a mod n is equivalent to b mod n then n divides b minus okay so of course you can take a larger a and smaller b that is totally up to u so i hope you people get the idea of this okay and next property that is here okay that is called integer or absolute value function just taking a short break coming in a minute okay the mean value people can read this so my mic is now working perfectly and we'll get a noise cancellation i will take the query uh just completing this in integer portion okay so the next property that that will be be commonly used will be the integer and absolute value. So, integer means that just the integer part of the component. So, for example, if I say int 3.14 is 3, int root 5 is 2, int minus 8.5 is 8. So, what it is said if you say int x equal to floor of x when x is positive. here it is floor of x it is floor of x and int x will be ceiling of x when x is a negative ceiling means that the greater value so there here what we can conclude that if we know how to estimate floor and ceiling then we can easily determine int values okay simple And absolute means that we are basically doing what? Giving a positive integer as an output. Whatever be the thing, we are giving a positive integer as output. So, that is simple. So, int means that the integer component we are trying to fetch. Int means integer component. Next property is exponential. I guess you all are aware of when something power 0, we are saying it is 1 and something power 1 then it is self when it is reverse power then it is basically 1 by a when there is a combination like a to the power m whole to the power n so basically there is a multiplication of m into n okay similarly when we have denominator same and powers are different then we can easily do what m plus n so these properties already you people have covered in the basic maths, but just for a clarity I had to put in here, okay. So this is thing for exponential, okay. So I guess it is not pretty tricky, just we have to, so a to the power 0 kind of thing will definitely appear multiple times while estimating the computational complexity via asymptotic analysis, okay. Then these, I guess these you can say not exactly the property is, but we know that now factorial is what? Let us say I write factorial 5, so it is what? 5 into factorial 4, that is further equal to 5 into 4 into factorial 3, that is further equal to 5 into 4 into 3 into factorial 2, that is further equal to 5 into 4 into 3 into 2 factorial 1. And that is further equal to 5 into 4 into 3 into 2 into 1 factorial 0. And here you can check when n is 0, the value should be what? Value should be 1. So what we will get 5 into 4 into 3 into 2 into 1 into 1, that will be 120. So this is a factorial. So what we basically doing, we are recursively calling this step again and again until we reach n equal to 0. Similarly, there is a famous series that is called Fibonacci. So, what it says, I will initially consider two values 0 and 1 and that is f of 0 and this is f of 1. So, when I have to determine f of 2, what will be the value? It will be f of 0 plus f of 1 that is 0 plus 1 equal to 1, then f of 3 is nothing but f of 1 plus f of 2, that is f of 1 is 1 plus f of 2 was 1, so it will be 2. Then f of 4 will be f of 3 plus f of 2, so it is what f of 3 is 2 and f of 2 was 1, so it will be 0. Just adding the conjugative number, so that is 1 0, then it will be 1, then adding 2 will be 2, then 1 and 2 will be 3, then 2 and 3 will be 5, 5 and 3 will be 8, 8 and 5 will be 13 and so on. So, this series is called Fibonacci series. So, that is also famous. So, in some of the asymptotic analysis, we will find these kind of series. But not probably, occasionally you will find, they are the special ones. So, I hope these two things are clear, factorial and Fibonacci. Now, the last component and the last part is polynomial. So, before discussing on this, Let me write one thing. a n to the power 6 plus p n to the power 5 plus c n to the power 4 plus t n square plus 39. If this is an expression. Simple expression we have. So, why I am taking n? Because here we are considering the n as input size. So, basically we have seen the expressions like in x terms. So, you can also assume in the terms of x. Now, I want that I should denote this thing in the memory or this thing in the computer. So, what we will do? So, exactly this equation is not saved. What will we save? It will be saved or it will be recreated by saving the value of a, b, c and d. So, I will preserve a, b, c, d. And I will use a term in summation thing if you just summation d equal to 0. So, I am writing capital D equal to 0 to d equal to 6 a of i n to the power i. So, basically what we are doing, we are converting this polynomial into a, so when there is a summation sign, this is basically a for loop or just recreating this. So, I had just saved a, b, c, d value. I had one information that highest degree is 6. Then I will be starting with 0 and raising to 6. So, what I will do when d equal to 0, what will happen? a of 0 n to the power 0 plus summation d equal to 1 to d equal to 6, a of i n to the power i. So, if you see a of 0 is the coefficient that is 39 and n to the power 0 is nothing but then plus now what I am doing a 1 n to the power 1 then summation of d equal to 2 d equal to 6 a of i n to the power i. So, what is a of 1 if you see here there is no n term. So, a of 1 will be what it will be 0. So, basically what we will get 39 plus next term will come that is a of 2 n to the power 2 plus summation of d equal to 3, d equal to 6, a of i n to the power i. So, here we are getting 39 plus a of 2 if you can check it is nothing but small d, d n square plus if you further expand this then we will get a of 3 n cube plus a of 4, a to the power 4 plus a of 5, a to the power 5 plus a of 6, a to the power 6. So, a of 3 is what? Nothing because no cubical term. So, this becomes 0. a of 4 is what? C. a of 5 is what? B. And a of 6 is what? A itself. So, basically what we are trying to do? We are trying to denote a mathematical expression. So, in the memory, so what we will do, we will store the coefficient and here it is a of 6, here it is a of 5, here it is a of 4 and this is a of 2. Other coefficients are missing. And one more, that is 39, that is a of 0. And if we want to recreate this equation, then what we will do, we will run a for loop or summation thing and that we start from 0 to 6 and then we will recreate this equation again okay i hope you people have get this but yes obviously doubts are there so punit enable mic those who are raising hand for their doubts okay hello hello yes uh good morning sir so i have one question that congruence thing if a is talking to b modern then if something is congruent then it would be covalent also And both of the functions, both of the properties will co-exist. Yes. Okay. Thank you. You can go ahead and then Satendra, then Dejasri, then Pooja, then Subhash. Yes. Hi. This is Shriyad. Yes. Am I audible? Yeah. Yes, audible. So, the absolute integer one, so the absolute integer for like suppose 3.7 which is round Will it be 4 or will it be 3? No, no. So there will be no rounding. We have to just identify the integer component. So rounded off. So that is different thing. So that we hadn't studied. So we have to just identify the integer component and declare that this is the integer. Oh, okay. Thank you. Just give me a comment. Okay. Next question. Hello, sir. Can you please re-explain the summation one again? So, this one says that I can denote a polynomial like this p n equal to i equal to 0 to d a of i n of i. So, now I will take another example for this. So, it is saying I can denote a polynomial in terms of n that is given from i equal to 0 to degree d and here a of i, n to the power i is given. So, simple if I take a n square plus p n plus c equal to 0, this is an quadratic expression we have. So, a of 2 is a, a of 1 is b and a of 0 is c. Now, I want to denote via the summation term. So, we have summation that will start from i equal to 0, go to the maximum degree that is 2 and here it will be a of i, n of i. So, if I expand it, so what will happen? a of 0, n of 0 plus a of 1, n of 1 plus a of 2, n of 2. So, just replacing the value. So, it will be c plus b n plus a n square. So, rearranging what we will get? a n square plus b n plus c. So, basically what we are doing, we are doing a, you can say, summation representation or basically whenever there is a summation that is also a for loop. So, using for loop, we can recreate the expression as and when needed. We have to just store the coefficient value. Let us say the expression was a n square plus c. So, here a2 is a, a1 is zero and a zero is c. So, if we store just the coefficient value and know the highest degree term then you can regenerate the equation again or we can say that we can store the equation in form of summation. Now, I hope your doubt is clear. Thank you sir. yeah so dinder or puja kumari yes actually it has been long time just so we have two things now coefficient and the variable part coefficient coefficient variable coefficient variable is n to the power 0 okay yes so i have to equal to two is okay so uh what is the best thing you can uh suggest me some example i will represent using this any example with values two three four five so i'm notable to recall actually it has been like Okay. So, likewise, these things are there, if you remember. Or 6x to the power 4 plus x plus 2 is there also. So, this I guess you can recall easily. So, here in place of x, I am using n. Now, I want to denote via the algebraic, via the summation. So, what I will do i will start from 0 degree maximum is 2 and a of i x to the power i so if i want to recreate from this then what i will do a of 0 x of 0 plus a of 1 x of 1 plus a of 2 x of 2 so what will happen a of 0 is 1 x of x power 0 will be what 1 plus a of 1 is 1 and x power 1 is x itself plus a2 is 3, 3x square. So, we can represent this equation like this one by just storing the coefficient array. So, coefficient array is what? 1, 1, 3, a0, a1 and a2. Clear? For here, we have x to the power 4 term. So, coefficient will be 2, 1, there is no x square term 0, there is no x cube term 0 and 6. Now we have coefficient arrow array and we are storing i equal to 0 to 4 was the maximum power a of 0 x of sorry a of i x of i. So that will be now denoted as a 0 x to the power 0 plus a 1 x to the power 1 plus a 2 x to the power 2 plus a 3 x to the power 3 plus a4 x to the power 4. So, if you see, this will be what? 2 x to the power 0 is 1 plus x that is a1 plus a2 is 0, a3 is 0 plus a4 is what? 6 x to the power 4. So, just this is a recreation of the equation, nothing else we are working. Okay, I hope it is clear. any other doubt hello hi yes i just am i audible sir good uh just hold for a second for two four five seconds yes please ask my question is from flows like where we are trying to achieve the remainder so I was asking why let me go to the slide yes so if here in the sixth example where we have achieved one so what I am asking is we should always try to achieve a positive number or negative number no negative you can get it but positive why we are getting because in division partner we have to identify a number that is either equal to the number or less than that one so in doing so we are getting a remainder as one so we always need to achieve the closest one yeah yes so uh likewise uh i can say yeah here 18 means minus 18 is the thing but we know that in division there is already a minus sign existing so both minus are making this plus okay so the eight minus 18 is just less than 17. Okay. Because here we can also take 16. If I say minus 17 and here you are targeting minus 16 because there was already existing minus will become plus. So, but minus 17 is less than 16 and we know that in division this portion should be either equal to or less than that one that's why we are taking minus 18 hitting okay okay okay so for example if we divide five with three so what we will do three will goes for one time and two will be our remainder okay so here we will never take a value like six three will go two times and six so of course we will get a wrong thing so here the thing is we have to take a number that is less than the existing one so we need to do these kind of things with minus numbers yes yes when there is a negative series then we have to be a little bit uh considerate there might be some error if we not tackle it properly otherwise uh what we have learned so far will work thank you hi sir uh subashi's descent so i have a question in the absolute value function so uh if you can go to that slide so it is said like whether like whatever the number like it is said like int of x is equal to uh x mode of x when the x is positive so whether it is positive or negative number we'll always have to take positive right in case of absolute value function ah yes in case of absolute value we have to take but in case of integer we have to just identify the integer component and give the output okay sir uh good morning sir good morning sir rohit here so i i have a i have a query uh on the congruence part uh of the modulus function uh that you yeah uh yes yes so how is uh you have mentioned a is congruent to b mod n how is that so that is a simple property when a mod n is equivalent to b mod n then we are then we are establishing this okay when we get same remainder and when two different numbers are being divided by same n then we are getting this so this is a congruence relation that holds okay so that is not equivalent to the congruence in the triangle that what we you people we have studied in 9th or 10th okay something so it's it's supposedly as well so like uh b would be uh congruent to a mod and then yes that so and divides a minus b taking which number as a and which number is we totally up to you okay so and uh sir any any uh application level example of this like how are we going to uh use this directly or indirectly it will appear then then we will check it out okay and let's say we can if we can establish this n divides b minus a then reverse engineering we can declare it this a equal to a is congruent to b model and then we can get that a mod n is equal to b model so same type of so uh what we can say that is there are the three stages okay first we are saying a mod n is equal to b mod n then we are claiming that is congruent to b mod n then we are claiming the n divides b minus a I'm writing okay so if this is true then reverse also we will we can establish okay so there it will be used yeah so this will be used in the algorithm analysis purpose directly may not appear but if we are in a situation that we are getting two different number difference divided by uh same n then we can do a reverse engineering here okay okay and sir uh i have one concern uh regarding uh the lab so so the lab would be uh would be taken by you or like uh we have i have seen like a student who is taking the lab actually most of the cases you will find tas are working if you have any issue so let me know then i will try to accommodate or change the student or even sometime i will also appear for taking the lands yes it would be really great sir if you if you can take it up because there are concerns that might get answered differently by your teacher and differently by your student because uh at post he is actually they are not a student they are scholars okay so they have to further teach after in two three years so but but but we'll try to do okay okay okay thanks yeah good morning sir some function formula is not clear which last one this one no sir uh previous slide formula has been uh already written by you which one this one yes sir yes sir so this is not a formula this is a representation actual value is this one that that in image can you explain sir with example okay here it is written a factorial factorial part I am not getting so accurately this is a you can say this is a structure of a recurrence recurrence relation, okay, where we will get the result in terms of function itself when i is greater than 0. Otherwise, we will get the function, the output at itself. And one example is factorial where value of n is 1 if i, if n is 0, otherwise it will keep on following this n into factorial n minus 1. Okay, so this is just a representation, do confused with this that's why i have put in the image here so i guess some of the students got confused so i just put an example yes sir thank you yeah i guess we can proceed uh yes two person are there amit kumar and uh i think anuja yes quickly i will take because that may be a problem how much you can do it in this part sir six whole six x power four yeah yes sir what i can't understand so this is just a expression we have okay i have randomly generated one so this could be yeah so its coefficient can be stored like this one hitting yes sir okay okay okay okay the last doubt i am taking and requesting so that we can proceed further because yeah so punit i guess it is done yeah yeah thank you thank you for your help okay so uh let me freeze one last property of this that is the logarithmic property so just it is kind of you should aware of so So, this is binary. So, most of the cases in algorithm, we will see this. When I say log, so we will assume it as base 2. And if there is different base, then that will definitely come. So, there are some small properties it is written. If it is ln, so it is base e. If it is log, then it is base 2. So, just two, three property will come. So, just go through it and if you have doubt, let me know. So, logarithmic thing, one important thing is that by default, the log meaning will be treated, will be treated as base 2. Why base 2 is famous? we know that we in terms of system, 0 and 1 are the two things. So, base 2 is primarily famous for it. Next, these are the standard notations behind the log. Just check out the properties. This may or may not appear in the algorithmic analysis, but we should be aware of. So, these are some property like log base C A into B can be divided into two component. Similarly, log B by A, log base A, log base B A can be split like this one. So, when there is, so this is nothing but log base B A to the power minus 1. So, we can get what minus of log B A. So, similarly other properties will come. So, if required during discussion of asymptotic analysis, I will also explain the property, from which property these things are coming. So, do not worry about that, you have to remember all these properties while doing the asymptotic analysis as and when required, I will let you know. So I guess this is another part, the algorithm, an algorithm is a finite step by step list of well-defined instructions for solving a particular problem. So this was you can say very naïve definition, a finite step by step list of well-defined instructions. Or more simplified one, what we can conclude that an algorithm is sequence of instruction for solving a problem. but with this different definition, there was an issue while making burger because we know that if algorithms should be applicable for subset of input, subset of input that already we know. And the best mechanism of doing an algorithm is employ the modular programming aspect, just, it is just a representation where main module is divided into different sub modules and that may be interdependent and that may not be interdependent. So, this is called as the modular programming that usually I guess you people are working professional. So, you are following while solving. For example, when we have to make a calculator program, so basically we make a main function and we call different functions of addition subtraction multiplication and division okay so these functions are called so that is called as the glory of the modular programming if there is bug in a function so your main program execution will not be hampered or fixing or we can say that removing those error is easy okay when we are solving via modular programming okay here Here just a simple or you can say first algorithm example. Just basically what we are doing. And one important thing in this class when I say some algorithm or something. So I am not targeting that it could be implementable. I am targeting what it should be, understand how actually the algo works. So depending upon your proficiency, you can use Python, you can use C, C++, whatever you want. But the thing is you should understand the logic behind that algorithm. For example, here is an array 31, 20, 21, 7 and 47 and our target is to identify highest element. Here it is an array data, the name of this array is what data of numerical value in the memory. We want to find location, loc and value max of the largest element. That is a simple thing. So simply what we will do? We will start with the first number, then we will compare first with second, whichever is highest will be preserved. So here highest value till now is 31. Now 31 is compared with 21, highest is 31. 31 is compared with 7, highest is 31. 31 is compared with 7, highest is 47. Its location is what? 5. So that is a basic strategy. We have to identify the highest number and its location. So what we will do? We will start from the first element, compare with and declare it as max. Initially, we declare the first element as max and we compare with the remaining element. The value of max will only change if we get a larger value like 47, otherwise it was remain fixed. So, that is a simple logic, very simple logic, but that covers the all algorithm, the algorithm will be applicable for 5 numbers, 50 number, 1000 number. And here the logic is sequentially processing, we declare first element as the largest element and keep on comparing with other element to change the value of the max or largest element. So this is very simple algorithmic logic. So here the entire algorithm is, when I am saying algorithm, I am talking about the logic, not about the code that you should remember. So you can implement in any of your favorite language. So the name of algorithm is largest element in array. So a non-empty array data with n numerical values is given. The algorithm find the location loc and the value of the max of the largest element. we have to first set some k equal to 1 that will initiate. Location initially will set 1 and max values initially set the data that is located at location 1. So, this is could be treated as initialization. Now, this k is a counter. This will guard up till which step the algorithm will run. So, I am setting k initial value to 2. Then what I am doing, if k is less than 1, n because we have n numbers. So, we have to very much ensure that when it becomes n then we will have to stop. So, this is a stopping criteria. This is a you can say stopping criteria. If k is greater than n then we will stop and location max and we will do an exit. okay. Otherwise, if max is less than data k, if at any instance, we have declared first value as max, if it is less than 47, if you remember last, then what we will do location will be k and max will be data k. Okay, so now logic is clear, we have to initialize first number as max, and its location as loc. And then we have to do the comparison with the remaining element and in the last, what we will get, we will get the number that is highest and its corresponding location. I hope this algorithm is clear. Now, here we will discuss about the components, components of algorithm. Before going into the component of algorithm just I want to convey because we are not covering a algorithm part we are just behind the algorithm part and discussing about the several other factors. So in lab you can easily correlate when let us say insertion sort when merge sort when quick sort is taught so you can easily map with your concept so do not worry about the lab maybe possible this week lab or probably in the next week we will cover some algorithm that will be directly asked in the lab. So, your concept or logic is clear here, you have to just do an implementation in the lab. But these two classes, because we had not covered any algorithm so far, it is just a max value identification. So, just the lab may be kind of a little bit tough for someone, those who are studying this algorithm first and maybe a little bit undirected also because we do not cover algorithm so far. So, just keep patience and if required, then I will also bring the part of the lab and try to help you out. So, let us discuss about the components of algorithm. So, in any algorithm, there could be steps, sequentially steps, there could be some control structure where the algorithm will flow, there will be an exit, there will be some variable there will be some comment usually we avoid but you all are professionals so primarily you are using so step control exit variable comment and of course there will be i o input output okay and there will be certain assignments okay assignments of the value so this is uh you can say the raw components of an algorithm that is step exit control comment variable assignment input of okay so these are you can say component of algorithm okay so just giving an overview key what are the parts of algo so that is step control exit variable and comment okay so a step of algorithms are executed one after another beginning with step one and go to step n or level unless there is some change in the control some change in the control so control may be transfer step n of an algorithm to a statement go to step so control will decide whether the algorithm will go sequentially or take a jump or continue whatever thing is so that will be determined by the control control like if this is the value that is also control structure. If else is a control, switch is a control, loops are holding certain controls. So control statement is quite important because it changes the normal or sequential flow of the algorithm. So control is important. We will also talk about the iterative control, sequential control and other control mechanism just after this. Now exit will definitely there to terminate the algorithm like get ch we are using or curly braces closing we are using. So that is to stop the algorithm, there should be there. Otherwise the algorithm will run for infinite or stuck in some loop or something so there will be a stop or exit statement here there is comment variable name and assignment that you people are aware of so comment we are putting to ensure the whenever there is an error bug fixing other stuffs that that you people can do okay and or that is famously known as debugging removing the bug debugging of the error debugging of the error so comments helps out so name of variable there are some policies but we okay oftenly adopt what could be the name of variable assignments are primarily done via the equal to but in some languages they also prefer like this okay then of course uh algorithm should have certain set of input and certain set of output. So, these are the seven you can say component that is, should be there in an algorithm or some of its part may be there in the algorithm. Okay, then there is some procedure. So, that is function in some of the code that is called sub module. So, here it is procedure function and in broader we always say it is the algorithm itself. okay so whenever there is written procedure so you understand it is kind of a some set of instruction that we have to execute okay so why i am changing because somewhere in some book you will find naming procedure some will find you will name function some will find algorithm okay so you do not have to confuse ultimately that is a logical arrangement run the code. So, talking about the different types of controls, that is important because that changes the exact flow of the algorithm that is sequential logic or that is also called as the sequential flow. Then sequential means that statement 1, 1, then 2, then 3, then 4, whatever the statement we have written will be executed 1 by 1, 1 by 1, 1 by 1 and till large so that is a sequential logic here there is no change in the sequential flow of the algorithm okay what we can say no change in the sequential flow of algorithm okay then there is selection logic selection means switch statement if you remember so if if certain condition hold then statement one will be executed otherwise statement two will be executed if nothing executed, then default will be executed. So, there is a conditional flow. First one was sequential flow, here it is a conditional flow. If certain condition meet out, then the flow will occur, otherwise it will not occur. So, that is a conditional flow. For example, we have single alternative, if else, double alternative means that if, else, if, else, if, else, if, else. So there are two alternatives. And sorry, in if, else, if and then else, there are two alternatives, either this one or this one. Here there are three alternative, multiple alternative, you can say switch statement, there are multiple alternatives. So why alternative? Because they changes the normal or sequential flow of the algorithm with respect to the certain condition that need to meet out okay now in third logic first one is sequential no worry whatever you have written will executed one after another when there is a conditional flow or we can say selection logic so it will depends upon the meeting certain criteria if x is less than 10 then my loop will then then i will run otherwise i will take a exit or stop so that will be a selection logic then last one is called iterative logic iterative means that same thing will appear again and again again and again again up till some condition meet out so here double alternatives multiple alternative examples are given okay just what wait for a while and this iterative logic is or repetitive flow is simple examples are loops. Next PPT I had there is iterative logic is given. So, let us try to write a procedure or an algorithm or a module or a function where we have to solve this quadratic expression and we know that to solve the quadratic expression, this is the basic formula. And before applying this formula, this d is the discriminant that is b square minus 4ac. Here I have written to be done by a student, but let me do. So, if discriminant is equal to 0, we will get one solution. If it is greater than 0, then we will get two solution if it is less than 0. So, no solution is possible. That is a simple strategy. So, let us try to write one procedure where we have to identify the root of this function, a generic thing. So, initially what we will do step 10, we have to take the value of a, b and c to be supplied or input by the user. Then what we will do? In the next step, we will estimate d or that is discriminant. That is a simple way of solving any quadratic expression in class 9th or 10th we have did. So, it is equal to nothing but under root of v square minus 4ac because we have already taken these components. So, we will let us get some value x. Then in the third step check, if d is equal to 0, double equal to, else if d is greater than 0, else of course, it is understood that d should be less than 0. So here, there are multiple alternatives. If d is 0, then it will declare one unique solution. Here d greater than 0 to 2 solution, otherwise no solution, this simple logical organization. Now you can use any of the programming language to estimate SQRT, to estimate other aspect but more or less the logic will remain same, the logic will remain same. So let us jump to the next part, next slide. So here this is an example of iterative flow because if we have iterative flow, if we have written a logic that the loop should run till 100, then it will run till 100 iteratively. So these are the structure of for loop and this is a structure of while loop. So we do first assignment, then we check the condition if it holds. then we have to term it otherwise the loop will continue and this is the structure of a while loop. Now before ending this lecture, I just want to give you a glimpse of what we are targeting or going to do when we perform algorithmic analysis. So algorithmic analysis and runtime is an important because we know that the subject name is design and analysis. of algorithm okay so uh if you talk about the algorithmic analysis so there's a process of evaluating the performance of algorithm in terms of efficiency and scalability how efficient your algorithm is or when we have multiple algorithm available so which algorithm is more efficient and what will happen when we scale the algorithm to a larger extent so basically in algorithm the input what will happen, happen when input increases. So that is the issue that we have to identify. So the primary goal of algorithm analysis is to understand how an algorithm will behave as the size of input data increases, that is important. So let us say we are working for 10 input, we are working for 100 input, we are working for 1000 input and so on. So how the algorithm will behave when the input size increases? So one of the common approach of analysis is to measure the running time of the algorithm as a function of input time. Key f of n will denote the algorithm where n is the input. As we increase the input, algorithm will consume more time and so on okay uh if we target to determine the computational complexity by just randomly considering different set of input so may be possible let's say we have tested our algorithm for 10 000 input but our algorithm may fail when the input becomes one million okay and let's say this process will be challenging because we have to every time taste the algorithm on different different aspect we have to chase the algorithm on different different input sizes and then also we are not confident that whether this algorithm will for example whenever we develop a website we test the number of hit simultaneous hit the website can take love okay if it is let's say i have declared that my website is working fine because it can simultaneously handle 5000 user but let's say one day 20 000 people start accessing your website so it will be trickiest or it will be difficult so we cannot claim that when the input is increases then the performance how the performance of algorithm vary so we need some mechanism or some method where we theoretically determine how the algorithm behavior changes over the input without being running the algorithm on our pc on different sets of input so this is just a theoretical analysis so of course there will be lot many number of assumptions as well. So for example, the last example we have max element. So in max element, what we can say that to identify the max element, what primarily we are doing? we are comparing we are comparing most of the time okay and after doing all the comparison we are declaring a result we are declaring a result so how this comparison okay will impact input size And one important factor is that comparison is the key operation in the algorithm. Because we will primarily target searching or sorting. So, function fn denoting the complexity of algorithm will primarily emphasize on the critical or primer operations that are being made. So, assignment will cost lower. Addition will cost lower, but comparison will cost higher because what is basically happening we are converting the binary equivalent of both the digit then comparing digit by digit then declaring the number. So, in that way comparison is the crucial operation. So, there are two factors now, one is the input size and other factor that decide the computational complexity is the dominating operation, dominating operation, likewise comparison. So, these two are the critical one. So, while determining the computational complexity, we have to bother about two primary factors that is input size and the dominating operation and in case of searching and sorting comparison will be the dominating operation. This means that when for a larger value of n we can omit the impact of other operation over the comparison operation. So, there are other factor written including the use of memory, use of parallelism, use of heuristic, other optimization techniques. So, that are there, but we are primarily targeting input size and the dominating operations. So, I guess I had some time, yes. So, suppose m is an algorithm and suppose n is the size of input. I am not asking for the queries because these are the general terms that is a kind of theoretical things happening. Whenever we will solve some numerical then I will take your queries. Suppose m is an algorithm and n is the size of input. So, suppose m is a insertion sort algorithm I am taking as an example. those who are aware of good but those who are not aware of don't take it worry will cover in detail okay so the time and space used by the algorithm are two main measures of the efficiency how much space an algorithm is using and how much time algorithm is taking to run will be the two critical or the main factors okay or majors of the algorithm okay so time is measured by counting the number of key operation. So, here it is important key operation or we sometimes we call as the dominating operation, operation and in searching and sorting the dominating operation is the number of comparison that we should remember. Specifically key operations are so defined that time of for other operation is much lesser for time of assignment if you see will be much, much less than that of comparison. So, that is a critical consideration here and the space measured by maximum memory needed by the algorithm. So, we are not going to more emphasize on this one, but we are going to more emphasize on the time complexity. Here it is written the complexity of an algorithm M is a function of f which give the running time and storage requirement and algorithm in terms of size of input data. As input increases, what how will be the behavior of our algorithm? That is the primary thing. So, in the next class, we will discuss more about the analysis and try to start asymptotic analysis that is big O, little O and big O, big omega and big theta. Then we will talk about little O and little omega okay so hope you people got this idea i will upload the ppt i have already uploaded of till last and this some pages i will upload okay and in the lab today we will see again the examples are appearing okay if the labs are not going good for today also then from the next loss onward i will try to be on boarded with you on for the lab session as well okay so thank you once again everyone and if you have some doubt so i can take it otherwise those who are done can leave the class so puneet provide access one by one to those who are raising hello yes good morning sir good morning uh sir my question is with respect to the modulus part so i mean with respect to the formulation if i have an imaginary as well as complex number does it also works along with the same side or it has a different kind of no no so in different programming languages they are handled differently so you can use it i was just creating a very simple thing so that's why i have ignored no solution but yes imaginary things are there you can use it okay any any example sir if you can give because i'm just trying to understand from the base no so just take any example like 2x square plus uh 4x plus 9 okay and try to solve it via this method. So maybe possible you will get an imaginary thing so that you can represent 2i plus 3 kind of, so that you can attempt. So there is provision. For example, 2x square plus 4x 9 will have two values. So primarily you will get b square minus 4ac will be what? b square is is 16 minus 4 into a is 2 and c is 9. So, of course, here there is a root of 16 minus 72. So, of course, it is a negative thing inside the root. So, you will get an imaginary value. So, we are in the third case where d is less than 0. So, we will get, we are I am declaring no solution we will, but you will get a imaginary out of it. So, that is 16 minus 72 of course will be 50 minus 56 so that is not solvable but using imaginary number concept you can get it okay so it is also likely to be happening in in a real-time operation I mean in any kind of real-time solution that also goes okay but if this expression has a existing solution so will land in the case where d is greater than 0. Here we are landing in the case where d is less than 0. So any real-world application, if you talk about, so maybe sometime we are stuck in this kind of thing. So we rearrange this. For example, the computational complexity, when we estimate, so we may stuck into this kind of function that represents the algorithm. So, but our target is not to solve this when we are doing asymptotic analysis. We are just trying to determine what is the behavior of the algorithm okay this is just an example okay this is not the how you we are we can write algorithm for this one okay okay yes and one one last part is to understand with respect to the congruent properties here if you can go back to that it's been I think commonly a bit while for us so we are trying to understand slightly yeah so the mathematical relations sir I am just trying to understand if you can give highlight how to make a cross with respect to the last statement like the medical corners relation defined with the follows is any like brief short example if you can give so that I had given I guess some examples here so basically what is our idea we have so if we are declaring that a is congruent to be mod n okay then this condition should hold that is simple so this if I'm saying is congruent to be modern then it is clear that when i divide a with n and b with m then both will result same value in the reverse term if you can say or if if this hold then i am saying this or if this hold then i am saying this so in both way it is correct okay okay sir thank you good morning sir good morning uh sir uh actually i have one question like um suppose we have an algorithm of polynomial okay so when we uh take the power up to six it is solvable by uh one algorithm means one searching and sorting so after increasing that power so So if we put that same searching or sorting type of algorithm, then suppose its complexity is very much high. So we need to jump to another sorting or searching technique. So like that, is there anything happened in real world or if something, some sorting searching we are using for the laser input, So, if we go for the higher values of input, then our sorting searching technique will be changed due to complexity. So, like that, if any example or real-world example is there, if you highlight on that. Okay. So, for example, your laser record, let's say it is around 100 or something in number. So, you are using insert and sort, but let us say there is a clock given to you and you have to do the searching or sorting in let us say 30 seconds. And when your laser record is 1 million, so it will not be performed in 30, but now the current architecture that we are using in our PC, so it may be complete. But if you use merge sort or other, so the time you can easily witness that it is taking lower than what is being taken by insert and sort. that is the clock round clock analysis we cannot perform before running the code but by doing the asymptotic analysis we are very much sure that the behavior of insertion sort will be version when the in n increases okay so and similarly there is a good example that you can easily correct let's say i had marks of student of 100 student in the class okay so one way is that i will pick one copy then i will come pick next copy and compare with and fix the position then i will compare third copy and then put it into the its location or one way is that I will first do a chunking of 10, 10, 10, 10 chunks, sort all those chunks and then merge them to form a collection. So first case was picking one copy comparing with all, picking second copy comparing with all or better to mix chunks. So mix chunking is nothing but it is a divide and conquer or merge solved so here you can witness the time taken will be lower getting yes yes sir yes sir thank you sir uh good morning sir good morning uh i said that this class is going really very well so i really appreciate your effort sir uh sir for the lab section i just have a suggestion if we can get the lab manual uh containing all the list of the experiment and what is needed to perform in that experiment that will be really helpful so that we can practice at our end okay from next lab onward i will i will try to uh do like this so in the class i will declare what would be the lab component because i am not covering any algorithm so far so it is little bit difficult for me to do so but uh the lab and so for example i have covered insertion sort so you have to do insertion sort in the lab i have covered merge sort so you have to do merge sort in the lab so So that will be a correlation you can easily get. But right now I cannot decide because I hadn't covered any algorithm so far. But we'll try from next lab, you should get a list of experiments that are to be performed in the next class so that on Friday or on Thursday you will receive a notification on your Moodle. Sure sir. Thank you sir. Yeah. Bye sir. Yeah. Good morning sir. Good morning. Actually, I just checked the last PDF, like yesterday's PDF, but I can't see the updated, like whatever the examples you gave, right? No, no, now you can see in the night I have uploaded.