I am paying a bunch of money in a Canadian University and learning from you fella, you are awesome.
@CppNuts4 жыл бұрын
Thanks man..
@vinayak186f33 жыл бұрын
Fr to India wapas aaja bhai
@vikaspai2943 жыл бұрын
sorry for being racist,but why do most punjabis go to canada?
@arpitchugh72973 жыл бұрын
@@vikaspai294 We have a lot money and very little methods to spend it.
@mjjala9343 жыл бұрын
Saw the video today morning for interview prep , got a question using map ds in my round-3, Solved it. And got placed, Thanx alott for making these videos....
@CppNuts3 жыл бұрын
Wao... Instant results.. 😀
@LoZiOcErCa4 жыл бұрын
It has become a joke, but the Indian (I assume you're indian) guy on youtube is always way better than any university professor on the globe!
@vinoddiwan57924 жыл бұрын
because we need to pass exams and want a job. It's in our blood.
@hackein94354 жыл бұрын
@@vinoddiwan5792 true, getting job is too hard, and the competition!
@CppNuts4 жыл бұрын
Thanks dude..
@yashwantmoharil58924 жыл бұрын
rightly said by vinod sir. From the beginning we have an impression that only if you do the conventional desk jobs,you'll get respect from society. maybe its wrong but the truth so everyone has to study
@nikhilpatil24823 жыл бұрын
@@yashwantmoharil5892 i dont't know why collsege faculty's are more focus on conversation and personal development we have lots of stuff to learn in engineering , and we take just a 40% of importance to coding and project and 60% how to face interviews and all fuck this all !!!!!!!!!!!!!!!!!
@videofountain5 жыл бұрын
An alternative is Map.insert({"LilSyntax",888}) for your example... The argument is a simple example of std::initializer_list ... This is a briefer syntax. std::make_pair is not always necessary today.
@CppNuts5 жыл бұрын
Yes, i forgot to mention this i guess.
@ajinkyapatil35993 жыл бұрын
Hats off to your work !!! I really do appreciate your presence here on KZbin behalf of all our developers community. 👏🏻👏🏻👏🏻
@markusbuchholz35185 жыл бұрын
Hello Rupesh! Generally speaking all your videos are very useful and carefully done! The content is also great. I am very glad of being the member if your channel. It will be also great to present, beside "the theory" some small projects to utilize the theory in practice. Anyway., please continue your channel. Keep fingers for you!
@CppNuts5 жыл бұрын
Sure man!! Today it self this thought crossed my, sure i will try this in future. Thanks for the suggestion and comment.
@senthilandavanp5 жыл бұрын
Simple and amazing 1)map template structure 2)map key should be unique. different way to insert the values in map a)Map.insert(std::make_pair(key,value)) b)Map.insert(std::pair(key,value)) c)Map[key] ; in this case value will be default 3)How map is Internally implemented. self balance search tree how to traverse In-order 4) By default map is ordered in Ascending, If we want to sort in descending order we need to use mapMap. You used vector as value. Value can be anything.Vector or map or any object. Probably, you could have included the time complexity of inserting the element although most people know it.
@mahesh42744 жыл бұрын
Thank you youtube algorithms for suggesting this video, just what I wanted, subscribed... liked...
@CppNuts4 жыл бұрын
Thanks man!!
@mahesh42744 жыл бұрын
@@CppNuts no no no , i should thank you, so thank you
@AnkurSingh-uo4vo4 жыл бұрын
that cleared my concept on maps
@GilFavor1013 жыл бұрын
Clutch! I just got help from reddit's r/cplusplus, and the code the guy/gal wrote had std::map in it, and I was JUST reading the docs on map, then I remembered you : ) Perfecto!
@shadowwoodsman36244 жыл бұрын
Thank you, CppNuts! I can now work on my data structures assignment with a better idea lol
@CppNuts4 жыл бұрын
Thanks... All the best..
@heathledger72914 жыл бұрын
thank u so much for putting out such good quality videos on stl.
@CppNuts4 жыл бұрын
Glad you like them!
@fromdjangoimport__help__35853 жыл бұрын
Better and more professional than code with harry , lol!
@dhanushambrose41794 жыл бұрын
thank you so much,All these concepts telling how the high level programing languages evolving .
@CppNuts4 жыл бұрын
Thanks man!!
@learningisfun37912 жыл бұрын
Sir in the multiset video why //for(const auto & e:multiset) I didn't understand it could you clarify. Thank you
@TorontoWangii2 жыл бұрын
Nice tutorial, simple and straightforward!
@shivamkumarsingh14204 жыл бұрын
hey mr rupesh your knowledge of c++ is good and your explanation is exellent .keep it up!
@CppNuts4 жыл бұрын
Thanks a ton
@amanbhardwaj53185 жыл бұрын
That's a great insight☺️. Please cover the working of unordered_map/unordered_set also in next videos. Reason I am asking this because i have tried to understand about how the collisions are handled in these unordered associative containers but still not sure how it is done exactly. It will be great if you can give some insights, from the time complexity point of view also.
@CppNuts5 жыл бұрын
Sure 👍
@ylmazalperen11944 жыл бұрын
Hello Sir ! I didn't understand meaning of auto&ell : m . Anybody help me for explanation.
@CppNuts4 жыл бұрын
kzbin.info/www/bejne/mqfEon-kl8l4ma8
@sumakatabattuni54283 жыл бұрын
awesome tutorial !! I have a doubt. You have told that keys once created cannot be deleted, but by using erase ( ) function i think we can. Please clarify
@CppNuts3 жыл бұрын
Thanks, please specify what point in video I said that?
@sumakatabattuni54283 жыл бұрын
@@CppNuts at 9:12 you mentioned it as once created it remains forever.
@CppNuts3 жыл бұрын
The point is you always update the value not the key. That's how it is fixed and can't be changed. And yes with erase you can delete key and value both togather.
@sumakatabattuni54283 жыл бұрын
@@CppNuts ohh ok thankyou
@neelpatel1224 жыл бұрын
Perfectly explained👏
@CppNuts4 жыл бұрын
Glad you liked it
@kirantirth51373 жыл бұрын
Can you please tell how to add comparison operator in case of a user defined class?
@senthilandavanp5 жыл бұрын
I had a doubt but my program clarified .what if the key is string and the key Value is "aBC" "ABC" . Are these same or different and insert into the map.It is inserted
@CppNuts5 жыл бұрын
They are different.
@gauthampracharya95924 жыл бұрын
Thanks for the great explanation!
@CppNuts4 жыл бұрын
Thanks man..
@JV-ld3oq4 жыл бұрын
I have subscribed, need more videos like this.
@CppNuts4 жыл бұрын
Thanks.. Sure..
@lucasanddre4 жыл бұрын
So can I say that a map is like an array of pointers? Each index is the value type and each pointer is a class?
@JohnWick-mk4ve4 жыл бұрын
one of the best explanations of maps.. sir can you also explain how to do search between two maps.. vlookup one column against keys of other maps and write to another file ?
@msbabjan23415 жыл бұрын
I am following ur videos, and they r really helpful.Thanks for that. But i want to ask u when r u uploading Data Structures videos? Kindly do it soon..👍
@CppNuts5 жыл бұрын
Thanks man.. Sure i am trying my best.. You will get it soon.
@cloudyric16474 жыл бұрын
I can not thank you enough for this video.
@CppNuts4 жыл бұрын
Glad it helped!
@AbdullahJirjees4 жыл бұрын
Hello and thank you for the video I am having this question assignment can anyone help me in this issue? interval_map is a data structure that efficiently associates intervals of keys of type K with values of type V. Your task is to implement the assign member function of this data structure, which is outlined below. interval_map is implemented on top of std::map. In case you are not entirely sure which functions std::map provides, what they do and which guarantees they provide, we provide an excerpt of the C++ standard here: Each key-value-pair (k,v) in the std::map means that the value v is associated with the interval from k (including) to the next key (excluding) in the std::map. Example: the std::map (0,'A'), (3,'B'), (5,'A') represents the mapping 0 -> 'A' 1 -> 'A' 2 -> 'A' 3 -> 'B' 4 -> 'B' 5 -> 'A' 6 -> 'A' 7 -> 'A' ... all the way to numeric_limits::max() The representation in the std::map must be canonical, that is, consecutive map entries must not have the same value: ..., (0,'A'), (3,'A'), ... is not allowed. Initially, the whole range of K is associated with a given initial value, passed to the constructor of the interval_map data structure. Key type K besides being copyable and assignable, is less-than comparable via operator< is bounded below, with the lowest value being std::numeric_limits::lowest() does not implement any other operations, in particular no equality comparison or arithmetic operators Value type V besides being copyable and assignable, is equality-comparable via operator== does not implement any other operations You are given the following source code: #include #include template class interval_map { std::map m_map; public: // constructor associates whole range of K with val by inserting (K_min, val) // into the map interval_map( V const& val) { m_map.insert(m_map.end(),std::make_pair(std::numeric_limits::lowest(),val)); } // Assign value val to interval [keyBegin, keyEnd). // Overwrite previous values in this interval. // Conforming to the C++ Standard Library conventions, the interval // includes keyBegin, but excludes keyEnd. // If !( keyBegin < keyEnd ), this designates an empty interval, // and assign must do nothing. void assign( K const& keyBegin, K const& keyEnd, V const& val ) {
@vighneshk5094 жыл бұрын
can you please explain the for each loop with more detail or give some resources to understand it better??
@JustinK04 жыл бұрын
@ Vighnesh Kadam whenever you iterate through a map you should have a loop like that if the map is called mp, you're not able to do mp.first or mp.second for (auto& m : mp)
@vighneshk5094 жыл бұрын
@@JustinK0 thanks man understood it !!
@ashminjaysonashminjayson23483 жыл бұрын
In the last example can't we use a vector of pairs?? I meant the scenario in which he stated that we can't use vectors and arrays.
@Phawrillztho4 жыл бұрын
Can you expand on the comparison of data within two different objects? You mentioned a function. value_comp is exclusively for comparisons within the same object? I am not sure where you were going with that.
@venkateshn98844 жыл бұрын
Awesome bro...Keep on doing in cpp
@CppNuts4 жыл бұрын
Thank you, I will
@aby_yadav Жыл бұрын
Rupesh, I am wondering how index operator must be working on underlying BST!
@destroyer207454 жыл бұрын
can you tell me how to practice and implement these topics??
@CppNuts4 жыл бұрын
You can use online programming competitions website
@destroyer207454 жыл бұрын
@@CppNuts but i dont think any online judge has some specific questions on this stl section
@karthickkumar13803 жыл бұрын
God You;
@CppNuts3 жыл бұрын
Thanks dude..
@JV-ld3oq4 жыл бұрын
Excellent, Thank you very much
@CppNuts4 жыл бұрын
Glad it was helpful!
@kaursnehjeet4 жыл бұрын
How to insert values in map through user input?
@shubhamshinde56434 жыл бұрын
Are map dynamic ??????
@Leon-rt9lt Жыл бұрын
thanks for this great video
@CppNuts Жыл бұрын
You are welcome
@arunrajak.b89873 жыл бұрын
Are maps implemented using hash tables or binary search tree, I have a confusion on this !!
@CppNuts3 жыл бұрын
Different languages use different things. Like Java Script uses hash map, where as C++ uses red black tree.
@shwetadalal15494 жыл бұрын
in the for loop when i remove the & operator it is giving the same output. Then what is the use of & in for statement??
@mehulchavda77124 жыл бұрын
if you dont use reference (&), then it will create copy everytime, and you dont want to do that because of size complexity
@vikku_195 жыл бұрын
But ultimately there are two values for one key. How?
@CppNuts5 жыл бұрын
Didn't get the question?
@vikku_195 жыл бұрын
@@CppNutsCppNuts you said, in a map, one key can have maximum one value but when we passed a vector, Amit had two values.
@Schoolroom94 жыл бұрын
@@vikku_19 this is what im confused
@almosteasy95904 жыл бұрын
@@Schoolroom9 Its simple... ' Key' is unique and value can be anything, since he added vector now, so values are now stored in vector. So its like [Amit ] : vector of values. Had it not been vector and int then 2nd value will replace first one.
@piyushkumar-wg8cv4 жыл бұрын
he is correct in video, here Amit is pointing to a vector (although it is not name but let's say it is vector v1) Amit(key) -> v1[ 234123413 2343413] Chotu(key) ->v2[90909009]
@teetanrobotics53634 жыл бұрын
Bro could you make a tutorial on map-filter-reduce in stl ?
@ehashanrabbipial94114 жыл бұрын
sometime we use map['a']++ with out setting its initial value . Does map sets 0 at key 'a' automatically?
@sriramkrishnamurthy44734 жыл бұрын
yes
@nikasbelogolov90194 жыл бұрын
How do I do nested maps like this one: { String: { String: String } }
@CppNuts4 жыл бұрын
Hi Nikas map if this is what you are asking.
@srijakatipally48474 жыл бұрын
May I know in which ide you are writing this code....
@CppNuts4 жыл бұрын
VS Code.
@jatinrauthan90753 жыл бұрын
loved it
@CppNuts3 жыл бұрын
Thanks
@Schoolroom94 жыл бұрын
at 2:01 you said, same same cannot have different values, but at 13:14 how , the key Amit has different values. :/
@sasoyu89224 жыл бұрын
I think you did not get the point, my english is not well but i'll try to explain. At the beginning of the video he explained the concept of map as a collection of entries key-value (string as Key and int as value). If the map Is organized as a bucket at the generic key "k" you can store more values (as he did in the last part using Vector). This seems great but leads to a problem called "collision"
@JustinK04 жыл бұрын
he said that you're not able to have 2 of the same key, even if the values are different but you are able to have 2 of the same value as long as the keys are different.
@BECE_SonamdeepKour4 жыл бұрын
MY PROGRAM IS NOT WORKING AND ITS SHOWING THIS ERROR, PLEASE HELP C:\Users\best buy\Desktop\Coding C++\Example_Map\main.cpp|15|error: request for member 'first' in 'el1', which is of non-class type 'int'| C:\Users\best buy\Desktop\Coding C++\Example_Map\main.cpp|15|error: request for member 'second' in 'el1', which is of non-class type 'int'| ||=== Build failed: 2 error(s), 2 warning(s) (0 minute(s), 0 second(s)) ===|
@aby_yadav Жыл бұрын
.first and . second should be applied on iterator, not on map object
@khushboo22294 жыл бұрын
Hey your videos have been really helpful for understanding the stl topic...😄 Can you please suggest me a platform where I can practice its basics so I can get a better command on this topic.
@CppNuts4 жыл бұрын
Thanks.. You can find map related problems in competitive programming and practice there.
@khushijain49693 жыл бұрын
👏
@berg.worldNow2 жыл бұрын
God 👏🏾👏🏾👏🏾👍🏿
@CppNuts2 жыл бұрын
Thanks..
@lakshaysingla27543 жыл бұрын
Sir not good UNtill here i was able to grab some part of the concept but now u speeded up almost 5X and I lost my control and not able to udnerstand
@CppNuts3 жыл бұрын
i hope there is an option to slow down the speed of video in youtube.
@mdirshadalam26173 жыл бұрын
Hi Rupesh, Please help me, I am not able to understood the below program how to correct ---------------------------------------------------------------------------------------------------------------------------------- #include #include using namespace std; typedef struct { int id; }Test; typedef struct { int x; std::map infoOfTest; }Resource; // We compare Test objects by their ids. bool operator
@CppNuts3 жыл бұрын
What part?
@aby_yadav Жыл бұрын
I can't see operator < for Resource structure.
@विशालकुमार-छ7त3 жыл бұрын
I will graduate from KZbin.
@CppNuts3 жыл бұрын
This is what i want.
@premkumarsr40212 жыл бұрын
Letters are very small.. Pls zoom the screen and make videos