The Best Demo on C++ STL and its Power: sets, vectors, pairs, maps, upper_bounds, and MORE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
when when I began with competitive programming I remember that it was around three weeks or something like that and I started seeing some fancy keywords in the code of other people that I was following and I realized that I really don't know see places that will and I it really became very overwhelming for me to step into that and see what that is all about because there were so many fancy keywords like bear with tacit multiset and I was like really overwhelmed about what this is all about but I I remember that at that point of time I really wanted someone professional someone who is like really great at competitive programming to teach me just about you know how to use them and what are these various things so that I can get started with my journey to become a good programmer and I remember that I just postponed all these things because I was not having some good mentor I was just trying things on my own and they did work out really well and but now I'm here I did a lot of hard work to cross two thousand plus rating on code versus I did a lot of submissions on code versus solved a hell lot of problems and I realized that C++ STL or all these fancy keywords that I used to ignore initially are super useful without them like it's really difficult to survive in a programming contest and also clear coding interviews because these are some other things which are so easy to use that people expect you to know them and the solutions won't pass if you don't use them so today's video is about C++ SEL and I hope you will like it hey guys this is me Richards welcome to yet another video today I want to talk about C++ STL it's a very very very important topic because C++ STL is about all the data structures and algorithms which are already implemented in C++ internal library and we can leverage them as programmers of C++ as developers in C++ and we can use them which are predefined which are pre implemented and we can use them to make our solutions more powerful we can use them to pass the various time limits of the problems that we want to solve and it's super awesome and I think it's very very important because without this I don't think you can clear the software interviews sets Maps all these things are something bits are reduced so much frequently and if don't know how to use them you are going to waste a lot of time people don't realize that once they are in the coding interview rounds and they have to use map set they don't remember the syntax how to use them there is so much time and confidence and ultimately they are not able to submit the solution and if you don't use C plus there's STL then maybe you are going to implement those functions yourself and that is very very difficult and not going to happen in the time limit that you are having so I would recommend that please invest a lot of time in C++ STL so that you are very much familiar about how it works how vector works how you can sort a vector of structs how you can maintain a set of structs and things like that so in this video what I wanted to do was quickly talk about and you know and get you familiarized with the various C++ SQL offerings that we have so to begin with let's start with vector vector it is nothing but an array or a list of one two three four let's say so let's say we are having 4 numbers 1 2 3 4 or let's shuffle them up let's make this 11 let's make this 2 then we have a 3 and let's have 14 of course it's going it's throwing error because I have to include the liability for that hash include' vector and this will go away all right so I have my vector now how do I access an element of the vector let's say I want to access the second element so in terms of zero-based indexing it is the index 1 that I want to access and I can do something like see out a 1 and so this is how you can simply access the second element of your vector and similarly you can do a lot of things let's say you want to sort this so you can do a dot begin a dot end I want to sort from the beginning till the end and this will do that all right so sort is again not there it's throwing an error so let's include this algorithm right so now this should go away now this is doing the sorting in n log in time and if you don't want to use E Plus STL then you will be implementing merge sort which takes so much time so this is why you should be familiarize with how you can do a lot of things in C++ STL it saves you time it makes a quote more powerful all right so that's good now let's save this is sorted so this looks something like 2 3 11 and 14 and now since it's sorted I can bind research on it to find out in log and time about whether an element is present in it or not so again that is something that we don't have to implement it's already there we can do something like bull present equal to binary search and we can say a dot begin 8 or 10 this is the search space we want to do binary search from starting to lending and I am interested in finding whether 3 is there so one is this another condition is when you check for a number which is not present that's another case so present binary search let's check for value maybe 4 so now this should be false and of course there should be true real quickly check if these things are working as this should be working so now our vector is sorted that's awesome but what else can we do what if I want to sort this out in descending order or what if I want to insert more elements in this so I can do something like push back and I can insert maybe hundred so Maya is still sorted which is great so I can again check if we have this number now so I can do a binary search a dot begin a dot end and there goes 100 all right that's awesome this should also be true we will check that but what else can we do so now the array contains has something like 2 3 11 14 because that's what we did above now we also insert 800 so this is the array contents that we have and now let's say I am interested in finding out oh wait let's in let's make this a bit more interesting let's insert 100 a couple of more times so now the error becomes nothing but we have 100 100 and 100 and let's then insert 123 so let me quickly do that alright so now this is what that looks like after this point and now let's say I am interested in finding the first occurrence of 100 in this or I want to get that traitor to the first occurrence of hundred in this so once that is sorted what you can do is you can use a lower bound on our array and what we are going to do is do a lower bound on 100 and what lower bound returns is an iterator iterator of what where iterator of vector ain't it freighter and if you are thinking this is like really getting complex don't worry about that we are going to simplify this a lot so yeah I am doing lower bound on the whole array on the value hundred and this should return or this should return the traitor pointing to this hundred because lower bound is nothing but give me the give me that rated to the first element which is greater than or equal to alright and similarly we have let's have another iterator we can do also an upper bound on this which now this will give the first element which is strictly greater than the number that you are performing the upper bound on now since we are performing lower bound and upper bound on 100 in this line IP will get the iterator to this hundred because this is the first element greater than or equal to hundred and then ID two is 123 because this is the first element which is strictly greater than hundred so don't get confused with lower bound and upper bound they both are something which are greater but lower bound is not that straight so it's greater than and equal to so if this is the case what I can also do is simply print the contents of IT and ID - alright let me do that and another interesting thing that we can do is print the difference between 92 - 81 and essentially this is nothing but 4 because iterators in victors are random what that means is you can simply perform arithmetic operations on them in constant pain so basically you can do subtraction between two vector traitors and this will take oh one time alright so what is the benefit of this so lower bound and upper bound on a sorted vector is done in login time using binary search so again this is a great capability that cp+ gave us like it's a very common thing in coding rounds that you sometimes have to get the first element which is greater than or equal to a given element and you don't have to implement that now because in login time you are just getting that for free now so these are some of the out-of-the-box capabilities that C++ officers and we should be definitely you know able to use them so what are the various things that we can do from the things that we have studied in loans so we can sort and vector of integers and we can do binary search to find out if it's if any element is present in that or not and if the vector is still sorted what we can do is we can also perform lower bounds and upper bounds on some int value so that we can get the first occurrence or we can get the first element which is strictly greater than that or first segment which is greater than or equal to that and of course we can also get the count of a number now because if you want to get the count of 100 simply perform an upper bound and lower bound and just take the difference of those two iterators because the I t2 is at 123 and I t1 as at this position and their difference will be 4 so you know exactly how many times hundred is occurring so that's great like within 2-3 minutes we learned a lot of things and that's awesome all right so let me first quickly go through this so that it doesn't get overwhelming for you let me first build this and let's see how this goes alright so we are over here and as you can see 100 and 123 is printed so it2 is at 123 I t's at 100 now let's also print this and you can see fiber has been printed so the number of times 100 was there was 5 actually to be honest right yeah so I have been inserted 100 here and then 4 times 0 so this is nothing but this to be honest so yeah this is fine this is printing 5 because 100 is occurring 5 times awesome but now let's also you know just I would like to show you in the watch how things look alright so we have an array a let's see how this looks like so the vector is having size 10 the first element is 2 then 3 then 11 then 14 then we have 100 100 100 100 and then 123 then we have this iterator right over here let's see what this is holding all right the value in iterator I T is 100 that we were expecting and it's a pointed as you can say it traders are sort of pointers and it's pointing to the value hundred and this is nothing but the first hundred that is right over here now let's also have a look at ID 2 as you can see over here the pointer is this and it's pointing to 123 that's awesome I guess now let's move forward ok I will quickly stop this and we are back so this looks good let me decrease the phone size so now the things look good we can perform a lower bound upper bound fantastic but what if I want to sort this vector in reverse order so what we can do is there is an overloaded function and you can pass nothing but a comparator function right over here to control what is the ordering that you want so let's pass some comparator from so let's pass some comparator function let's call that F right now and define a comparator functional right over here in global space so comparator function is nothing but it returns true and false and if you want to sort this in decreasing order what we can do is you can say return X is greater than Y and now this should sort the array or the vector in descending order and let's quickly print that so how do we print the vector again we can use iterators to print the vectors so you can do something like iterator my t3 then we can do something like for I t3 equal to a dot begin my t3 is not equal to a dot and a t3 plus plus and we can simply print star I t3 so this is how you can print a vector and now things should be good and the contents should be reversed let's have a quick look if it's working or not so as you can see the vector is sorted in descending order and that's great we have just learned how to do that but here is another interesting and here is another interesting thing that we can do so I believe that this iterator concept can be like really difficult to understand and really hard to type so c++ ism like really emerging now and just to print the vector what we can do is simply do something like for int X in our vector a we just want to print X and this will take care of everything and instead of vector and iterate over here we can simply say Auto and C++ is intelligent enough to see that the lower bound is being performed on a vector called a and it's a vector of ends so of course this is an iterator iterator of what iterator of a vector of ends so this is how c++ really saves your time now and things look really really awesome so now we don't need this I T 3 and just to print we can do something like for index in AC out X and that's awesome and if you if you do something like X plus plus things won't really change the vector contents like your vector values will stay what they were like 120 300 hundred and so on on but if you want to really also iterate on your vector and simultaneously update the values what you can do is iterate by reference and just add an emphasis and right over here I will just increase the phone size to focus on that and you can add an emphasize just to iterate by reference and now any changes made over here to X will be applied back on that particular element of the vector so if I do this now let's let's just you know believe this and simply then just copy paste this right over here and now let's iterate normally and simply print the contents and now you can see the values will be updated so let's quickly you know try to run this and see if it's working so as you can see now one twenty four hundred one hundred one one is incremented and this is how and this is how we can iterate by reference on a vector all right this that's awesome now the drawback of this is like we are first inserting elements and then sorting and only then we can perform lower bounds upper bounds and things like that what if we want to insert elements in random order like I want to insert fourteen ten ten thousand then maybe one then maybe negative 1 and then maybe ten thousand and things like that I want to insert numbers in random order and after each operation I also want to do queries in between like I really want to know the first number which is greater than some particular number so to handle all those cases what we have is called a set and what we can do is I will just quickly remove all this and I will move this to a vector function let's say void vector demo and everything is right there so we don't have to worry about it now let's talk about a set demo and let that be in this function alright so again to sum up in vectors you can insert numbers at the end using pushon dress code back and then once you're arrested which you can do using the sort function right over here you can perform various functions like lower bound and upper bound which in just log n time where n is the number of elements in the vector so in just login time they can give you the first element which is greater than or equal to X or the first element which is strictly greater than X and you can also check whether a number is present or not and all those kind of things but this only works when the array is completely sorted and sorting takes and login time so now let's say your address sorted and now you insert some number or you insert some three phone numbers and then you have to again sort your array to you know do again efficiently answer queries about lower bound and upper bound but sorting takes n log and time so that's something we want to avoid we want some data structure where we can keep on inserting elements also in log n time and keep on performing options like lower bound and upper bound as well in login time this is what we want so to do that we have set set is nothing but certain s let's say of course set we have to include it let's go up and include set alright so now to insert a number in set we can do something like s not insert 1 s not insert 2 and so I not what if we want to so what is happening over here so set internally maintains the ascending order sequence in these numbers so now if I insert s dot insert let's say minus 1 and then let's insert let's say minus 10 so now if I iterate on the contents of my set it will be in ascending order which is negative 10 will become coming first followed by minus 1 then 1 and 2 let's quickly check if it's working so for int X in s see out X and then and then we can do something like see out Randall so light so let's quickly check out the set demo from our main let's call that and see if it's working all right as you can see -10 came first - 1 1 & 2 so this is the beauty of set and each operation is in just login time so no matter if so this is where set becomes farfel farfel then vector in vector you can simply insert at the end and if your vector was sorted and if you insert some number it will disturb the ordering of the vector unless and until the last number that you're inserting is the max or greater than the max of the present vector so this is where cell comes into picture and really dominates it like the insert operation is just login time so at any time your complete collection is sorted and you don't have to perform a sort operation explicitly whenever you are inserting some new number which is the case in vector and sorting is in login so yeah this is why I love sets really will they are just very cheap login time is like really great time complexity when we are talking in terms of computed programming so that's fine now what else can I do with sets to be honest you can do a lot of things so let's now so now the contents of the set R minus 10 minus 1 1 & 2 now let's say I'm interested in now let's say I'm interested in finding whether minus 1 is present in a set or not so what we can do is we can say auto i t equal to s dot find find what find minus 1 what it does is it tries to find the from negative one is present if it's present it returns the iterator to that so IIT will now point in so I after this name will be pointing to negative 1 over here and if some element is not present this will return the iterator s dot end so what we can do is if I T is equal to s dot end it means the element was not present see out not present and otherwise we can simply say and otherwise you can simply say it's present in fact we can also print the value by sea out star IT handle alright that's great but what if I want to find the first number in the set which is greater than negative one or which is greater than zero how do I do that so if we want strictly greater than that we can use upper bound and how that work is and how that works is auto I t2 equal to s dot lower bound remember that initially in vectors lower bound was a separate function and we used to pass the a dot begin a dot and over here button said since it's already sorted it's always sorted the class itself is having the function lower bound exposed to the users so now we can do s dot lower bound and we can simply do let's say minus one so this will give me again what iterator to the first element in the set which is greater than or equal to minus 1 so this will give me exactly this but let's say if I was interested in finding strictly greater so I can do something like upper bound so upper bound of minus one is one and upper bound of zero will also be pointing to one in fact we can print the contents of both the traitors just to see if we are right or not and this should print nothing but one another interesting scenario over here is what if we try to find the upper bound of two now upper bound of two does not exist in a set so what will it do it will do nothing but return the any guesses what will this do of course it will return the iterator has not end because it's it's something that he was not able to find within the set so there was no iterator for which upper bound of to exists and this is will get executed ooh sorry can't find something like that all right so if everything went well I think we will see all these things that we had just implemented right over here now let's quickly run this all right so we have friend as I said it's minus 10 minus 1 1 & 2 let's come down and I start find minus 1 let's see what resistor running it's returning iterator and it's having the value minus 1 awesome because we try to find and it found it so it goes to else and it says present it prints the value let's go to the screen and verify that yeah as you can see present minus 1 and now we do upper bound Oh minus 1 and upper bound on 0 so this is pointing to one and I t3 let's see is also pointing to an awesome so as you can see when n1 are printed right over here and we are over here trying to do the upper bound of 2 let's see what is it oh hi t for responding to end that's awesome and it should print oops or you can't find something like that great so our code run exactly as we wanted and now we are in a position where we can have some numbers have them in some sorted order you can insert any new number it will just cost me login time to insert that number where n is the present number of integers in my set and my set will always stay store sorted which means I have the capabilities to find the next greater element in just login time which is so damn awesome so this is why I really love sets this is why I really love vectors I field sets are really very very very powerful than vectors and these are something that you should definitely know let's also quickly do a demo on map think that I want to do over here was give you a brief overview about the C++ STL and how we can use it to do really great things so I hope you I hope this video is useful to you let me know in comments I would really like to work on feedback and try to make more such videos so moving on with the map map is what map is as the name says mapping something to something so what we can do is map in to end and call that a of course we have to insert map let's go right at the top and include map so coming back yeah so map int comma int a now what we can do is we can say a of one is 100 you can say a of 2 is minus 1 a of 3 is 200 and so I know we can do any random thing that we want we can do something like this is equal to 0 or weight 0 is not interesting one so we can do something like this and we are mapping into int and we can do something like map care to int as well and let's call that as count and let's say we have a string X equal to let's say Richard Chan I'm so self of s maybe and then what we can do is iterate on our present string so for each character see in my string X I want count c plus plus and now I can safely know how many times a character occurs in my name so now I can do something like C out count count of a how many times a occurs and then maybe also how many times said occurs and I want to find that so again map is nothing but so map is again something like set and in log and time you can map something to something so all these statements right over here take log n time where n is the present size of the map or the present number of items that the map contains so eats these mappings take login time and then you can retrieve the value mapped to the character array again in log n time so I really love the log in time factor and map can do wonders in this case we just used a map of care to end to find out the frequency of any character in a given in log and pain so of course building this map takes that time proportional to the length of the string but once we have done this we can at anytime in log in time tell how many times our character is occurring so the these were the basic cases about set map and their time complexities I hope it gets you started with C++ STL it's not really that difficult and it has so many use cases like I simply just taught you over here like it can map into nth string to end character went into care care to end and so many things so many permutations are possible but there are so many you know realizations or implementations where we leverage these data structures to really solve really great problems and that's the whole intent so I will quickly try to close this video just by showing you a very powerful implementation that we can achieve using C plus STN so all right I will do over here now and what I'm going to do over here is solve a very big problem for you now let's say let's say the question is I will give you queries like add interval X to Y right for example I will say add the interval 2 to 3 right at 2 to 3 I can say and maybe 10 to 20 maybe I can say add 30 to 400 and then I say give me the interval which contains the point 13 give me the interval that contains the point 13 so in this case it will be 10 to 20 and now we can now just to make this case easier let's say I am saying the add function will always be something which does not overlaps with the previous interval sort gets moist so I will never say something like 399 to 450 so because this will merge with this to generate one overlapped interval so I don't want I won't give you such complex queries I will always ensure that whatever interval I am inserting is like really out of all those complex cases so I will say something like 450 or 401 - 450 because it doesn't overlap and when I say give me the interval containing the point 400 you should give 30 to 400 otherwise you should if I say 401 you should give me in this interval so this is something that I want you to implement and we can do this very easily using sets so what we are going to do here is have a set of what set of pairs no pair is what pair of and combined this is my set s let's call it and let's insert the numbers first I will comment this out so now I am inserting pairs in my set and what is pair and pair is nothing but X comma Y so if I am declaring a pair of end comment 1 comma 1 is a pair minus 1 comma minus 12 is a pair minus 1 comma 14 is a pair - 14 comma 3 43 is a pair so all these are pair pair of what in comment we can have pair of into coma care then it should be something like 1 comma 3 and 3 43 then we can have dollar over here so yeah pair of into coma care is something like this pair but what I am doing this pair of end comment what I am going to do is insert the pairs like this so 2 comma 3 and then we have so these are the intervals that insert in my set and of course as I mentioned set is always ordered in ascending order so what does ascending order in terms of pair means let's try to compare two pairs for integers we know that 2 is less than 3 so we already know when we are inserting the limits we can think about what is the order in which the set is maintaining that but in pairs also we can find that order in which they are stored so 2 comma 3 is 2 is smaller than 10 2010 20 smaller than 30 400 and 400 1 2 comma 450 is greatest among them so how does so how does comparison between pairs work so to compare two pairs let's say a comma B and C comma D so if a is less than C we will say that the first way with this a comma B is smaller than C comma D and it will come before C comedy in our set but if a is equal to C then the comparison is done between B and D so if B is less than B then a comma B will come before C comma D so this is how the comparison between pair works and in this case even if we do something like we inserted and random order like 401 before then maybe 1020 and 2/3 and 3400 after this line 2 comma 3 will be coming first then we will have I think 1020 and then we will have 30 comma 400 and then we will have 400 1 comma 4 15 so so based on how peer comparison works you can easily say that first the pairs are ordered in their first index which is the x coordinates I would say and if x coordinates are same for two pairs they are ordered on their y coordinates so in this case since x coordinates are always different 2 3 comes first then 10 20 then 30 400 and 400 450 so now let's say we are interested in finding some point and what is the interval that contains that so for example if I say 21 so we know that 21 is not contain anything but let's say if I say 31 so we know that it's right over here so what I can do is I can do nothing but an upper bound so if I do an upper bound on 31 comma and I will add any value over here I don't care about that but I will generate a pair like 31 comma question mark we will see what we have to fill over here but let's say we are doing an upper bound on 31 comma something like that so of course it will give us the iterator to this strictly greater than 31 comma something is 400 1 comma 4 15 are set and we will go one step back and we come to this and we if this pair contains 31 then we can say that yeah this is the interval that has it otherwise we can safely say there is no pair in a set which contains the given point let's try some other values again let's try maybe 9 or maybe 12 so if you do it upper bound on 12 comma something we will get iterator to 30 comma 400 because 2 is not smaller because 2 is smaller than 12 10 is smaller than 12 30 is the first invent greater than 12 so when we are doing an upper bound on this pair we get 30 gamma 400 and we go one step back 10 20 does it contain 12 yes it does and we are done boom this is how it's working now let's handle some corner case like what if we do something like 10 so now if we do an upper bound we can also get 10 comma 20 so let's say if we are doing an upper bound on 10 comma 0 so what is the first element in our collection of set which is greater than 10 comma 0 of course is 10 20 because x-coordinate is same then we do the comparison in terms of Y and 20 is greater so yeah 10 20 is the first you can say pair in our set which is greater than 10 comma 0 so now we get iterator of this and based on our algorithm we go one step back and we reach 2 comma 3 and our algorithm works and it says that and our algorithm fails as it says thus as it says that 2 comma so we go one step back now to 2 comma 3 based on our algorithm and it fails miserably because it says that 10 is not contained in an interval but it was there so this question mark over here should be big enough so that we always get 30 comma 400 while performing upper bound so we can do this put this as end underscored max so that now whenever we are performing an upper bound we get to 13 over 400 right because nothing can be greater than entered into underscore max so now you'll always come to 3400 go back and just see if things are working out so let's quickly you know implement this and see if it's working so if I want to check my point let's say 30 or let's say 50 so this is the point that we are going to check and how do we check it it's easy auto I t equal to as dot lower no upper bound on what so since our set is of pair int and end we also have to perform an upper bound with passing in a pair of integers I understand that the only thing we had was a single integer but since our set is of pairs we can perform upper bound on pairs and we are you filling in this value as inter underscore Max to leverage this opportunity so that we come to the next pair in this case 401 and 450 and then we will simply go one step back so I t minus minus so let's quickly derive that pair first current equal to star I T now if current dot first is less than equal to the point and and point is of course less than equal to current dot second so when whenever we generate a pair we can pick up the first value by current out first and the second value we can access using current one second so our point will be contained in an interval only if it lies between the first and second values of that pair so you can say yes it's present and you can also print the pair current dot first current or second awesome else you can say the given point is not lying in any interval awesome so now if things go well they should run but of course we have to handle some of the corner cases for example what if this point is nothing but let's say 1 so now when we do an upper bound we get 2 comma 3 then we do i t- will you try to go one step back and that doesn't exist so that's where we failed so if IIT is same as s dot begin it means we can simply say the point is not linked in any interval because there is nothing we can go back so we can do something like we can simply return here itself written and if that's not the case you can go one step back and this will work like a charm so let's try to see if what happens in case of one and then we will slowly and slowly see how things change based on different value of point all right let's run this all right we are over here let's see what our set contains sizes four as you can see the order 2 comma 3 then 10 20 then 30 400 and then 401 450 notice that we inserted them in random order but set is always ordered and that's how it's storing it so now when I do the upper bound upper bound of 1 comment on disk on max it should return 2 comma 3 let's see what I it is having exactly 2 comma 3 awesome is it s not begin yes it is so it friends the given point is not linking in exactly this so let's try to go back and update the value of point and see how this changes so let me just quickly change the value of point let's change that to maybe 11 all right now let's try to perform the upper bound now this time we get 30 comma 400 because point is 11 now over here it's 1 but I changed it in this debugger value so point is 11 now not 1 don't get mistaken by this Molina okay so yeah point was 11 up about of course 30 , 400 it should have yeah we go one step back mighty - - we take the current so what is the current pair 10 comma 20 now if we now 1020 contains 11 so we print yes its present and we say yes it's present in 10 comma 20 awesome all right now let's try for one last value now let me change the value of point to 400 as that will be a bit tricky now let's present now let's perform an upper bound and we get 401 for 15 then we go one step back we get the current pair which is 30 comma 400 as you can see right over here then we check a 400 as present in that oh yes it's present and we printed over here as you can see yes it's written 3400 awesome that's also working now let's also try for 401 and we can close this its 401 yeah well your point is 101 now I am performing upper bound on my set what will I get so to be honest there is no element greater than 401 and enter under school max no pair is there so it should return s dot and let's see what's happening yes it's end over here as you can see in I T then we go one step back so we come over here we take the current pair which is 401 and 450 and the point value is nothing but 401 and of course it's present in that and it should print that boom so guys this is how so the guys this is why I love sets and you can see the power of STL we just solved a very complex problem and the best thing is all these operations and operations are happening in just login time and we are also giving the interval in this login time we are not iterating on the n intervals that we already have in our set just to find out what is the interval that contains the given number just in login time we are doing everything and that's the power of STL I hope you like this video I hope you understood how to use set and map how to use vector how to sort it how to pass a comparator function to sort them or control the order in which you want to sort with and things like that I hope you liked this video and this is a series I will try to make more videos try to go into more details and talk about the other offerings that C++ has like on a road map like unordered map unordered set and they have all they have better time complexities as they are using hashing but yeah I mean this is a long journey and I hope this video was useful I will see you next time let me know in comments if this was useful bye bye
Info
Channel: Rachit Jain
Views: 285,985
Rating: 4.9258661 out of 5
Keywords: c++ stl, sets c++, maps c++, unordered_map, set, map, pair, vector, c++ vector, vector cpp, set cpp, map cpp, unordered_map cpp, upper_bound cpp, lower_bound cpp, stl tutorial, cpp stl, competitive programming, coding interview, coding interview problems, c++ tutorial stl, c++, standard template library, dynamic programming, microsoft software engineer
Id: g-1Cn3ccwXY
Channel Id: undefined
Length: 43min 48sec (2628 seconds)
Published: Fri Dec 28 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.