So this is the question we have often. And the question is like, there is already a bubble shot, already like given hypo of a bubble shot. And we need to find out how many swaps that need to count to the result of that sorted aggregate. so that's the question uh those who don't know what is bubble shot let me explain you bubble shot is like a simple sorting algorithm only okay that i repeatedly compares adjacent elements and swap them uh if they are in a wrong order basically they are in a wrong order and we need to separate so it compares like a to the adjacent elements okay suppose if i will tell value in a raw manner it's like if left element is greater than the right element then swap them something like that and why there is a bubble term and it comes in this sorting algorithm it comes from the fact that during every pass okay the largest element uh the largest unsorted element okay gradually bubbles up to the end of the array so that's why it's called uh bubble shot okay something like that uh if there is a water okay inside there is so many of bubbles okay the larger bubble will go ever first right okay something like a movie concert term i'm with um secret superstar right so who's my example they try bubble shorter hey bubbles are going up so you have to go up like this okay something like that right you've seen that same same so something like that uh that's why the larger area also there are many passes okay like we are going to do uh every pass okay and we need to we don't need to count the end element because we knew that uh after first pass okay uh that element is got sorted okay so that's why we will not consider that element and we will go for rest of the element and then in the second pass the last two elements we will like uh so something like that um okay huh you can go up today i'm going to in these two only so that's why i have written there uh do i need to write okay that's right so overshot is a single on sorting number basically sorting number So, that repeatedly compares adjacent elements, right, adjacent elements, you know, adjacent elements, and then, and so that's the silicon, okay, so, what happened, about something like So if I'm going to tell you one simple example, let's say 5, 3, 8, 4, 2, copy, something 5 limits and if we sort this expected okay we can write expected area will be two three fourth okay so in the first pass what do i mean by pass okay in the first pass when the one one okay so i'll take that out okay and uh like it after this uh in the first pass okay it will compare okay something will compare to the adjacent element right so i'll copy this array again and paste it here compare five and five and three okay five and three so it will compare uh because the left element which is five is greater than three what does it mean so correct so then it will result out as a three five okay again this is pass one only going on okay we didn't completed pass one okay pass one is going on so okay you can expect after ending of the pass one so after ending of the pass one you can expect you can expect uh the larger element in the array is when to end yeah that's an element to recover last one end of the array it's end of the array okay so we pass one each other okay so pass one going on then we will compare the uh five and eight okay and then we will compare five and eight okay so we will compare five and eight left element is not greater than right element left element is five right element is eight so it is not written element so don't swap something we can write okay then compare um array is like a as it is it lets me add it now i'll take that out element is something like that okay then next okay so compare okay something like you can imagine abhi kya ho raha hooga inside i plus plus ho gaya hooga yaya phir j plus plus ho gaya hooga kyunki joh point abhi we will do the code basically okay so uh it like pointing out to till now it is pointing out to 5 okay after it doesn't satisfy the condition something like that happen okay now it is pointing to eight okay so that's why what we can do now we are comparing eight and four okay just its next element okay where it is pointing just sits next element if it is they don't know so obviously eight is greater than four left is greater than right so swap okay it is greater than four so we swap it then particularly swap then three is four eight two now compare eight and two eight and two okay so obviously eight is greater left element is greater than right element okay so swap double swap if it will swap then three five four two no two eight okay then the largest element eight has reached its correct position So, always remember in the bubble shot after pass 1, so always remember after pass 1, the larger element will always reach to its correct position. Now, pass 2 will start. See, there is no guarantee that after pass 1, may the maybe the like this couple thing array will sort or maybe not will not sort okay so that's why we'll do the passes until it gets sorted okay so that's why we'll keep one condition also okay don't worry so that's how we will keep the pass 2 pass 3 okay pass and until it creates okay so if i am going to write the code hope you hope you understand like how pass 1 when now what will happen my pass 2 because this is important it is important because we are not going to compare this element okay it will be fast two okay it will be fast two okay so you will get to see after the past two that five will reach to this position okay this two position and two will somewhere else around okay not two okay i'm not taking as a two specifically but the motto is the larger element will go to this position okay something like that okay and we will not compare this one also because this is already sorted right it's correct position so that's why that's how there is also kind of like we can we are not comparing uh the anth element but we are comparing in the each pass like a n minus one and minus two and minus three comparisons okay that's how also we are like a something time complexity also like a lesser but not like a lesser than the quick search okay yeah so if i am going to write the board of this okay then how it will be like i'll write one function okay that's bubble short okay def means is a keyword to introduce the function declaration okay so i'm taking one uh parameter as an array okay then n equals to we'll find first length length of the array okay because we have uh we have to go up to that end of the that's why we have to find the n correct then or i in a range of okay why in a range of then for j in a range of n minus one okay Why we are taking n-1 because we have to compare to, I will understand, I will tell you that we are also calculating the first pass, so why we don't need to compare, so don't think that n-1 is for the last one okay last element n-1 is for like a we have to compare its existent element right so we will like uh for the array uh not out of index something like that is there right array out of index or something like that error is there to get rid of that we are taking up to this one so i i'm writing the code you can able to understand through that if area of j which is a left element then if it is greater than why it is okay okay yeah j plus one okay okay this is a simple if array of j is greater than area of j plus one then simply swap okay both of them area of j when will on again ref j area of j plus one okay equals two okay full j plus one area of j okay so this is only the port of uh this one like a version yeah okay so if we will try run this okay now it will be so this will go like yeah someone is sent like for n minus i minus one something like that i think so in the chat right it's the one written sorrow umar and yeah we can also write like that okay so this is a better version of like a bubble shot nothing just okay so after what does it mean like after each pass one more element is already in its correct position right so that's what only p has written in it therefore we don't need to compare it again n minus i minus one the game is already okay so that's why we write like n minus i minus one okay we don't need to compare to the last element. Okay. So this is what it is for. Yeah. So I don't think so we need to drive around this. Okay. This one because we can able to reflect where this I will point out okay where the j will point out correct so we'll go to the question okay uh there is a question like um do the number of count swaps okay so nothing just we can take one number swaps okay okay it goes to zero because there is no swaps happen yet okay then what we can do uh after each swapping okay here after each swap i can just write num swaps plus equals to one okay it means like uh like how many swaps happened duration of like like sorting sorting of this study right so we can so i mean i can show you the first like okay how the first pass will happen taking one example simple example like here for now i'm taking three element on it as export one then i toast to zero j toast to zero okay we'll start then if array of i'm writing a of okay a of 0 is a of 1 okay why a of 1 because j plus 1 right we are comparing the same value with j plus 1 value right so that's why a of 0 is greater than a of 1 then like if 6 is so another it will compare to this okay this will swap so 4 1 6 then again uh i equals to 1 j equals to 0 will happen okay then it will compare six uh then it will compare array of a 1 with array of a 2 because j equals to 1 so array of a 1 will be 1 so it will compare with 6 is greater than 1 and then sorry i equals to 1 I am talking about i equals to 1 j equals to 0 so there there the array will be like 416 in the input and then it will come to 4 is greater than 1 okay and then it will swap then 1 it's sorted right and then again it will go for i equals to 1, j equals to 1 it will come as a false okay it will say it's already sorted it will meanwhile it will also increase the number of swaps how many swaps it happened so the same thing okay so this is all about the question of this one okay so uh any doubt is there um regarding the question or regarding anything else because we have it all right it looks me very fun yeah i allowed my collection of yeah i can hear you yeah the class challenges i'm not seeing any test cases was it intention or something is missed out what happened sample test cases are not available for the bubble show Yeah. Even in the chat box, I found that even for the second query also, minimum distance between two points also, there are no sample test cases. Okay. Let me check. Okay. Find up challenges, tap insert, minimum distance. Here we have the, like, okay, let me tell you. Okay. okay this was a symptom can you see now that's fine nobody confirmed i'll just check and kill open shot 127. test cases is there right no i just tried and it is still saying that no sample test kits are available no test cases are available while submitting Yeah, while running the code. I did not click submit yet while running the code it is showing that. Oh, while running the code while submitting. Okay, so now you can see. Let me leave you one. Hope if you will submit now, it will come input 00 as a first test cases. Okay, it will check and then it will you can able to see. Okay. Thank you. Thank you. no sample test yeah but while you're submitting it'll get just go window yeah hi go window uh hello uh listen brother there have been a mistake i missed out one uh five i guess it was test five so can i retake it like you know it's already open you can submit it all right all right thank you uh yeah you're not audible okay if you have any doubt i think you might just want you can test it in the chat i'll see it from the okay so um just was pushed out okay so people to okay so this is a very simple question so both is a mathematical question i would get this one okay not any logically then so if you know okay in distance how to calculate um like basically how i'm going to do it there's no idea of that sense you are given it n points and it will be frame each point is represented by its coordinate x and y your task is to find the minimum included distance between any two distinct points any two distinct points mainly any two not same point distinct point okay the including distance between two points x1 y1 and x2 y2 is calculated as x2 minus x1 square plus y2 minus y1 square whole square root okay so this is how you calculate the distance okay so uh points okay okay so we'll take this example okay even don't need to take this example because i'm going to do it so let's say we have it four points okay next five coordinate and we need to find the very closest point in between this so first of all what is the algorithm is i'll divide uh this two point or like a five point system means three two okay something like that we'll divide it then uh i'll divide as a left and the right okay something and from the left i'll calculate the uh that to apply the formula and calculate the distance okay minimum between them okay i'll calculate that so and so on and from the right side also so this left side is done right so left side we we got one main value as a minimum okay Okay, so then I'll go to the right side points. Okay, then I'll find the minimum distance between them by calculating Euclidean distance formula. And then it's not done then yet, right? Because we calculated just the left side and right side, then we have to compare between them, correct? then i'll compare between them which is the minimum then i'll find out the value okay now if you think this is done yet no this is not done yet because we just calculated we just divided this okay and this correct this point what happened if we know about this two point okay so let's say if these two points are minimum we didn't calculate it right or let's say we didn't calculate it of this two point we just divided like this okay minus five four and minus five minus four okay we just calculated like that and divided between them and calculated the minimum what happened if we are like getting the minimum distance between two cross cross points right we have to calculate correct then we'll go for that also and we will calculate between them okay then we'll compare the that value which can uh the result out in left and right okay we'll compare with that if it is lesser then we'll declare this current point as a lesser point okay so something like that okay hope you know about what is process point algorithm and And if I will show you what it will be, okay, so let me, I found it, okay, so we are, we are also applying the math, right? so there is a uh there is a import function like a import math so that you can use the all the mathematical functions also like math dot sqrt okay or if you can do import matters the closest pair okay closest pair and the points will come how the points will come in now we have to convert them into arrows because that those are the wrong numbers right so we have to apply one for loops and we can we can convert convert this into area okay we'll do that also closest point and then we'll sort the points by its coordinates okay points are sort okay i'll tell you why i'm sorting over and i'll take it out okay and now after this distance p1 p2 okay first p1 point then p2 point okay and then we calculate the dx value okay dx p1 of zero okay p1 of zero minus p2 of zero value okay because these two are arrays okay these two are errors so we'll calculate this okay x2 minus x forming okay then divide y2 second value right so for the second value area of the second then from this function we will return return m dot sqrt ym dot import math as it and yeah then square root let's come down so square so dx multiply dx plus dy multiply dy okay so I am squaring then finding out the square root so this is the formula done okay then we'll check for like ads cases okay now uh we'll find the minimum right so another function i will take okay call solve okay so you can solve i take again the points and then i'll check the length of their points okay first and then so points would have minimum two points right two like something so it is like a or like two points means that's why it's one right one so this what i mean right these two points okay correct so we will check for like edge cases if n is less than if n is less than equals to three if n is less than equals to three in minimum distance goes to slope of inf 151 or i in a range okay what we are doing we are iterating through these points okay and then we are finding the minimum okay uh before this i want to show you another thing okay let's just remove these things okay just remove these things then what uh i told you like we are dividing the points also into the left right and the right side right so for that okay um here we will write mid equals to n equals to divided it and left equals to is the array right so points of of mid 90 goes to end of minutes of, wait, this is the last of, so mid to till end, okay. Now what I will call, I will simply call left minimum, okay, we are pending the left side of minimum solve of left okay means this left side okay simply right minimum equals to solve of right okay then minimum between them okay this too so for this i'll take one d value which will take to my return right minimum okay then we will find the cross also right the cross part so uh okay so from for the cross part how we will write like we will find the make the value we will try and also if we will confuse okay though it is also simple made okay so this is a 2d array right so i'm taking mid of zero okay so let's end it and very exciting so then we will strip those of them we can strip longer writing points a absolute value so usual in this matrix is less than d stripped off uh by a white card coordinate also so for that we do like straight dots so i'm using lambda function here okay so you should also get familiar but is not required of. There it is, just to introduce. I'll introduce to the long bar. For time, you may range. Okay, length of strip, j equals to i plus 1. So, for that, 9 G is the number of script, okay, script box G, one, okay, minus, Yeah, if this is greater than, then break, raise, A turns 2, minimum, random, A minus distance, we have to write one distance function, and so here, we already get to write, so it we will pass the two points, even and the two. We will pass, right? We got J. I'm going to get down, you know, you know the magnetorite here. So, you can compare, S, I rearrange, M, C rearrange, A plus 1, any one of these things is, any one of, any one of these things, reduce the risk of self-having and touching, look to the distance, start, this one, close the strength, do things for j plus 1, also return the whole distance, and then also return the sum of points j. So one function is there to calculate the distance between that. Another function whole solve is there to calculate the minimum distance. okay correct so then if in the import okay the points will come then how we will map support that uh i'm telling is for i in the range okay so simply we will use the map function or you can take for any range or like anything okay and so now why it goes to mark of and comma input dot speed then points so we also introduce one points right and start again in what manner x comma y then we will call this function closest okay and it will go to the respective function okay and it will solve okay okay so this is only the two portions okay solve it for today but yeah um i told you i have something for you today right so let me show you that um so first thing is uh let me see not able to understand please exclaim it you can you can see here is not very important what i'm going to tell you now you can also run by yourself and understand i already said the portland So I think it got confused. it got confused in case we have this seven okay seven will compare to five okay it should be five yes i'm sorry um let me change can you guys resubmit it now hope it will show you bro current is using amazon aws to store those values east one uss one yep okay i'm sorry for that yeah so so as you pursued like uh this ai and ds right and in the future also you need to go through this stuff of a deal and lstm cnn based okay and i'm getting some of the mails okay so where where the resources would be and where to study from okay that would be easy and easy to visualize also okay so yeah so for that okay i i personally follow these things okay when i'm going out or like when i'm going to study this okay so so first resources is like so that campus x channel right so i didn't include it you can go through that youtube channel okay i can follow this if you want to code okay you want to really understand okay go to this site okay so this is a lead code of this ml kind of things correct uh if i will go to this okay you can able to see many things okay so if i will expand okay so loss function regarding the question these are the questions by the way so regarding the loss function there are 20 questions are there okay so all all other things from ml okay nothing is logic kind of things okay so if i'm going to study transformer okay so it will come out to be it will also give me the architecture of this transformer okay and event okay what are the layers are there if i want if i'm going to like solve the questions regarding that particular layer it will also give like there is a layer one of the layer from like tokenization right so tokenization is a layer where uh each like a character or like a texture i'm not employing tokens okay or like a vectors so if i'm going to like click on this i'll get one questions regarding that okay and i'll give even one sample code i can you can submit it and write the metric so uh same is like embedding layer okay positional encoding so you can see in a visualized manner okay so go through this okay you can explore like i'm not going to like tell you like what is this but you go through this and explore what are these things okay what are these questions okay you can you can actually understand what is this um and you can solve start solving problems okay this problem is not working okay okay okay so if you go to the problem okay you can start by solving easy questions okay easy okay so this is a simple sigmod function okay for the classification you can click on it and you can just simply write the function of a sigmod okay and you can also import okay uh also you can see like how the sigboard function work okay sigmod activation function okay yes how the gradient will be what are the test cases okay you can see the test results okay this is the best website okay i don't know we've heard of this okay and all like a rms prop optimizer okay atom optimizer matrix transfers okay um and yeah so there are not only from the transformers you can see there is also from like a k3 is also there okay i'm excited okay so this is the architecture of a k3 14. you can also solve the problems regarding that and let me show you to cnn1 uh rnn lstm um yes vision transforming okay so there's also uh like a so these above is likely for the llm right so this is for the vlm vlm where the vision transform starts where you have given the image size of a section cross section okay and you have to pass by that image okay into some other transformations okay and you can convert that so yeah so this is okay so this is an awesome website i have found okay and uh b a u p a l x net oh yeah questions are there you can go ahead and solve it okay so this is for the like a liquid version of tensor tonic okay and then no stage so from from the basics if you want to start what is the neural network and understand how it is working this is the very their minimum and basic website you can go and search it if you heard of those terms and if you what do i mean by terms is like a learning rate activation function regularization okay what's the problem type whether the classification or regression okay you can add also the neural network here okay in the horizontal voice and you can add also in the vertical voice okay can we reduce it suppose this is the classification problem we can say there are two points okay we have to classify classify between two points okay so there is also four problem statement okay so this is the very hard one to classify okay and this is the very basics one if you will run this you can see how the error training loss is like going down okay and how many epochs it is taking to classify this okay so this is how it is classified finally okay there is no more in a we can go into it um we'll reduce this so let's say everything is everything i want to reset yeah i want to reset on the window like this yeah you can see so this is perfectly classified okay and this classified around like a 500 or 400 box okay so this is a very uh okay you can see visualize the neural network okay in this neuron what it is classified in this neuron what part it is classified in this one how it is classified this one so you can see and you can also play around what are the activation function you're taken a sigmoid okay or like a uh if i'm going to say sigmoid okay and there is no any kind of overflip so i will not take a variation okay so let's say i'll increase also uh increase also depth wise okay yeah okay so you can also play around with it so this is another website okay and for like a which one adam hurley yes so for the cnn people so like a computer vision people so if you want to explore okay so there is a website called adam okay so you can oh if you can know about that data sets what is the data sets it's like a so i will talk it okay so you can see so this is a multi-class classification right so if you will see here they are very like they you can see the numbers over here zero one two three four seven eight nine okay so when i draw eight okay it properly classified as an eight and you can see like how each like a layer of this how it detected the edges first of all okay so the very basics where it is starting from this this layer okay so it is starting from this layer and it is like adding the filters in the first filter it is calculated as this edges okay so this edge is inclusive okay the second layer it is calculated these edges and the below edges okay the third layer upper edges it's calculated somehow it is calculating the edges and also reducing the inner size and this calculating as a eight okay uh this is very complex okay if you will not like a like kind of a beginner okay but there is a very basics minimum one which i found for the cnn okay not only the cnn we want to understand like a cnn max pooling what is a uh another like a there are many terms uh amnest data set okay so yeah you can go to this website okay as priority please add where these peoples are maintaining this website till now you can go to this and let's say this is the input image okay oh let's say i'm taking one face and amnest okay so this is the shirt okay so let's say i'm taking instead of shirt sneaker i'm taking right okay so this is the sneaker in which you do see okay if uh if you want to know how machine is learning likely is this a sneaker or not okay something like that and how it is calculating edgewise okay the bare minimum where they started from that uh yanliko okay yanliko version okay you just go to this website and uh there's a matrix multiplication i think list okay so what is this filter is filter is to uh like a calculate the edges okay so let's say in first pass it calculated these edges okay in the second first this edges third pass this exercise okay i'm just i'm just playing okay let's play okay let's just calculate the matrix okay i'm pause okay let's say i'm pausing okay so it uh went to this okay suppose the image is there it pacify the image into zero zero okay zero zero something like that and this is by the way zero one okay some not like a rgb okay there is only the two channels is available zero and one okay you can see zero means black one means white okay so it uh it is here okay like a filter is here 0 6 0.6 0.7 0.76 okay you can see here zero point shapes then 0.7 0.7 it is calculating with this filter okay and output as a zero okay which is this one okay okay now then we go to this okay so it is calculated from this one this part this one i'll play simply okay yeah then so if you will see it is calculated this upper edge and then below edge okay so yeah so this is a really awesome website okay so what it is calculated we selected as a top edge filter so it is the red part you see these are the top edge filter it is calculated so you do not need to like a remember these minus one zero minus one zero okay something like this is for the top pairs okay you can simply like a google out and you can simply so if you want to calculate the right x okay so it will calculate the right right part of this okay we'll see yeah so if you will see the red red side is coming on the very right point okay because this filter is used to calculate the right test okay so that's why so also like a 2.1 2.0 something value stuff okay so yeah so also if you will see you want to see the max pulling okay so max pulling is nothing but like reducing the image size okay do the smaller reason so also you study this you can able to know why we are reducing the image okay and also make yourself question that if we are reducing the image does that matter even like a present like a machine will confuse like a the high resolution will uh image will like a better to clarify the machines right the lower resolution image like a it will not better right so ask this question also make yourself okay last will gpt okay what is the reason behind we are reducing okay if we are reducing then uh image will not cut down okay if image will cut down then what are the methods to add the things okay there is a padding kind of things we are adding to not to like a cut down the image so suppose this image if we are here so what do we do padding add, padding add, reduce ho ke bhi, that means, image ko, something like that. uh, fashion and mystery, bhoots a t-shirt hain, so, image to put a reading, okay, and if you are a reader, okay, something like book reader, okay, So, you can go through and study what I just thought, I am not going through, image generation parameter. So, by the way, this image generation, you know how this image generation things came from physics. Okay. So, what is physics theory? There is a, you're in fidgets, okay, where the elements are like a, I don't know, which fidgets from is used, fusion Z, yeah, diffusion is there, but before the diffusion, there is another thing, obviously there is a diffusion, but before diffusion, there is also another town that is starting from b i guess yeah brownian motion yeah so brownian motion is came from like a introduced to the this image energy kind of things okay so which we call like also energy based models okay these things uh so yeah so this is how image generation came into the picture and then uh yeah what i was telling like if you're a book reader okay you can simply go to this website of like a d2 l okay right into deep learning okay and so you can go through and there is all the concepts are there like a multi-player first percent okay and then computer vision nlp okay we open this then there are some sort of uh sub chapters is that can go go and study this sundays okay so these are the resources and obviously if you don't understand then you can go to campuses okay you put the campuses study from this guy yeah so he's very good yeah make myself better so these are some of the things no no no so much you know don't think that there is much to learn but these are very basics or like it is again repeating repeating repeating okay once you grasp one concept okay that concept is inspired from another concept there is nothing like again you have to study the cnn okay once you've studied the neurons okay the again neurons are like going into the cnn also okay rnn also okay and uh linearly like neural network also so you can follow these websites okay and yeah another thing i forgot so this is um i don't think so you will get the time to study the papers okay but yeah this website is a uh like containing the papers okay no song is a guy i don't know there is a profile appearing that i'm able to see like a paper mostly papers are available here okay how the things are started from the very granular how the speaker recognition evolution is started okay and uh yeah this is the godfather of ai if you heard of he introduced the knowledge distillation also okay and he introduced the dropout okay um yeah so this is also the very very important websites okay also there is a part of the robotics so rl reference so yeah deep rl is kind of a sensible um yeah so these are the websites which will help you but don't collect the resources as i'm going like a penis one first okay then if like a mind is telling like yeah i need to go to look at these tables you can go and look get it you know somebody said any questions with there learn with campus works campuses and python is made for the boilerplate what you want to against what yeah thanks jishnu roy chowdhury this is another very best website bv by croft okay to visualize the llm okay uh deep lizard all the websites were like i said right okay thank you thank you guys you don't need to anything said yeah thanks you can uh like this guy said all the websites are that i've shown here um people are to dwell on the website something so yeah since i'm also like this so can we end up the class or like do you have any questions yes i know this is very short kind of okay and please thanks sir okay no questions okay questions can okay thank you everyone okay hope you got to know some of the things happy sunday happy weekend okay i I allowed your mic at Wingor Room. First of all, thanks for this lot of details. Now I feel like I need to learn a lot. I got to learn a lot today. Sir, you were solving the algorithm. And you wrote the code. I have to know that what was your approach. I was trying to solve it in a different way. Maybe that's not the correct way. Assume that there is a point where all the equidistance are. Equidistance is not equal to me. It's possible that it's a wrong approach. So it's not equidistance, maybe any distance. The point may be exist in minus minus the kind of very long. Okay, that's a very, okay, let me go through, again. By the way, I'm recording to stop now, because I don't know this. hey we don't need others okay guys thank you everyone