Map in C++ with practical examples - step by step Data Structures tutorial

Поділитися
Вставка
  • Опубліковано 7 лип 2024
  • 📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
    C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
    🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.
    Download Visual Assist here: bit.ly/WT-CB
    I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
    Download Ultra Edit here: bit.ly/UE-CB
    It is a powerful, secure text editor designed specifically for programmers.
    In modern C++ a map is data collection that stores elements in the form of key-value pairs. In some other languages (C#, Java, JS, Python,...), this type of collection is also known as a dictionary.
    Key has to be unique and of a simple data type, like a string or a number.
    Value doesn't have to be unique and it can be a simple or a complex data type (like a structure, list, another map, etc).
    An important characteristic of the map collection is that it orders elements by key in ascending order (a, b, c, d,... or 1, 2, 3, 4,...)
    This ordering works very fast and it is available out of the box, so you don't have to do anything for this to work.
    Another similar collection is unsorted_map, and the only difference is that it doesn't sort its elements by a key.
    In this video you'll learn how to use map data collection, when to use map data collection and we'll build two apps together that will help you understand this concept better.
    ☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. You can use the link below to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
    However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
    Follow me on other platforms:
    Instagram 📸 - / truecodebeauty
    Twitter 🐦- / truecodebeauty
  • Наука та технологія

КОМЕНТАРІ • 221

  • @CodeBeauty
    @CodeBeauty  2 роки тому +22

    📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
    C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
    🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.

  • @ILGiullareDiCorte
    @ILGiullareDiCorte 2 роки тому +38

    I want to add a note. std::map is implemented like a red-black tree (a type of balanced tree, that's why the "map" is sorted). This means that insert, search and remove are O(log(n)).
    std::unordered_map is implemented like a hash table (with buckets) and insert, search and remove are amortized O(1). So choose well, because the 2 data structures are really different and have huge difference in performance. Btw great video and thanks for sharing your knowledge to people that are learning c++ ^^

  • @kishensharma5651
    @kishensharma5651 2 роки тому +30

    This was a very concise implementation of maps in C++, thank you again for creating the tutorials that you do

    • @CodeBeauty
      @CodeBeauty  2 роки тому +3

      You are welcome! ☺️🥰

  • @brandonblackwell1216
    @brandonblackwell1216 2 роки тому +8

    Finally a map video from you ! Ive been waiting for this !

  • @ethangold4900
    @ethangold4900 2 роки тому +6

    15:55, yes I confirm that scary face is an attack, an attack that is supposed to scare the opponent with a scary face, this will lower the opponent's speed stat in battle

    • @CodeBeauty
      @CodeBeauty  2 роки тому +2

      Thank you for clarifying this! 😁🔥🔥
      I also did some research and after seeing Charmander's scary face myself, I was stunned and terrified! 😁
      I hereby testify that everything stated in the video and in this comment is correct! 😏😁

  • @k.s.5815
    @k.s.5815 3 місяці тому +2

    I was confused by my professor's explanation and videos in UA-cam but eventually found out this one to be very straightforward and easy to learn, thanks a lot!!

  • @yuhuili6738
    @yuhuili6738 Рік тому +6

    I gotta say this! When I learned about OOP, I subscribed to this channel and RIGHT NOW! My professor just put the link of this video in this weekreading schedule! Amazing. Thank you so much for the explanation!!!

    • @CodeBeauty
      @CodeBeauty  Рік тому +7

      Your professor is awesome, he really cares about teaching, give him my greetings! 🥰
      Most of my professors would just give us a book with a bunch of abstract examples and students had to figure it out on our own. It took 5x more time 🥲

  • @amrrasslan4329
    @amrrasslan4329 Рік тому +1

    you made a long story short . thank you for being to the point without a long introduction hats off to you :)

  • @sabrinanastasi5809
    @sabrinanastasi5809 Рік тому

    You seem so happy sharing your knowledge on your videos. As a woman myself that motivates me to keep going on the coding journey. I struggled with maps and your video helped a lot. Thank you!

  • @ajitpatil6532
    @ajitpatil6532 2 роки тому +2

    I love how this video is on point and precise. Your C++ vids are great.

  • @luisalamo2658
    @luisalamo2658 Рік тому

    Thank you for creating this Playlist. My fear of C++ disappeared! I bought to you a coffee but I forgot to write a message to you on that platform. Keep doing gorgeous work here, I have been a Java developer for years and I'm so happy to relearn the fundamentals or new things in other languages through this kind of tutorial on YT.

  • @palmtrees9474
    @palmtrees9474 2 роки тому +1

    Hvala na videu! Prelepa si Saldina! Respekt! Pozdrav iz Srbije!

  • @bernardseno2535
    @bernardseno2535 2 роки тому +1

    Great! I have been looking for a great tutorial about map and there you are Ma'am! Thank you!

  • @diwasbajracharya3745
    @diwasbajracharya3745 2 роки тому +6

    Its surprising that I was just searching for maps and here we are!!!BTW done with both yours and caleb's 10hr c++.Thanks to you, its becoming easier than I expected.

    • @CodeBeauty
      @CodeBeauty  2 роки тому +2

      I'm happy to hear that! ❤️🤗

  • @rohitcr2k
    @rohitcr2k 2 роки тому +2

    Your channel is a treasure for (budding) programmers. 💜

  • @altheahicks9574
    @altheahicks9574 Рік тому

    you always explain the minutiae of these topics really clearly and you have a good sense of which points to emphasize for a beginner. I always come to your channel when I don't quite understand a topic in c++. thanks so much!

  • @aruneshsingh5698
    @aruneshsingh5698 Рік тому +3

    The way you explain these topics is very fascinating. Please make videos on heaps , hashing and other data structures

  • @gobybike5016
    @gobybike5016 2 роки тому +2

    I wrote my own map facilities about 12 years ago before I knew STL has map. I could’ve saved a lot of time if I knew about the built in map features. I learned a few things from your video. Thanks.

  • @thebadluckraven8217
    @thebadluckraven8217 2 роки тому

    I love all your videos and now i can comprehend what im doing much better than any of the books ive read. If you could make a video on Vectors i would greatly appreciate it ! Thank you for everything you do!

  • @gbaransano7070
    @gbaransano7070 2 роки тому +8

    can you also please do a tutorial of C++ GUI login & registration form done in Visual Studio Code 2019 with an SQL database? Thanks in advance :)

  • @shawaizhassan6253
    @shawaizhassan6253 2 роки тому

    You're making coders lives easy...thanks a lot!!!

  • @neepunpatil5201
    @neepunpatil5201 2 роки тому +1

    Finallly Completed your OOP C++ course

  • @SivasaiPrime
    @SivasaiPrime 2 роки тому +3

    Wow...I loved it....taking examples of pokemons and their attacks..is awesome...brings my childhood memories ❤️❤️❤️

  • @RoboticsWithHrithik
    @RoboticsWithHrithik 2 роки тому +1

    I was searching for this video finally its here 👍

  • @ashishgusain9494
    @ashishgusain9494 2 роки тому +1

    Best video i have ever watch for string example.

  • @canhobby6286
    @canhobby6286 2 роки тому

    I was looking for C++ associative arrays like in PHP, and you showed me how - AND, many thanks for the black background from you blind Canadian subscriber..

  • @CesarAugustoRL
    @CesarAugustoRL 2 роки тому +1

    Very useful video, thank you!

  • @mmuzzammil8394
    @mmuzzammil8394 2 роки тому +1

    Thank you. Video was helpful and clear!

  • @neepunpatil5201
    @neepunpatil5201 2 роки тому +9

    Full DSA course ma'am please 🥺
    I understand much better when you teach

  • @muhanadglb8881
    @muhanadglb8881 2 роки тому +2

    You are my hero in C++ .......👍👍👍👍👍

    • @CodeBeauty
      @CodeBeauty  2 роки тому

      ☺️🥰🥰

    • @muhanadglb8881
      @muhanadglb8881 2 роки тому

      keep going in these videos. ..... it's really useful .

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 2 роки тому +1

    Thanksgiving? Tons of people celebrate this wonderful autumn holiday. But what if you need to finish this damn project? Right, just open the video and you will answer to the question you tried to resolve for weeks. Bravo!

  • @dp0813
    @dp0813 Рік тому +1

    Truly helpful! Danke!

  • @monstergamingiraq7927
    @monstergamingiraq7927 2 роки тому +1

    Finally a new video ...Thanks a lot i really appreciate your efforts❤️

  • @mitchong8753
    @mitchong8753 Рік тому

    Thank You! Your videos on C++ are helping me pass an online college course. I am at the final project, and needed to know if C++ had anything like a dictionary in Python.

  • @alsanabe5241
    @alsanabe5241 4 місяці тому

    Thank you for the clarification.

  • @iqrajaved3593
    @iqrajaved3593 2 роки тому +1

    Your videos are very helpful for us.please keep it up.. your videos also improving our English.Thank you 🥰

  • @baibhavvikas1767
    @baibhavvikas1767 2 роки тому

    thank you for teaching it all in such a simple way .

  • @subhasrini2706
    @subhasrini2706 2 роки тому

    Thank you soo much because i couldn't able to figure out this MAP ans how to use the Maps correctly...Thanks a lot!!

  • @AudreyGraceB
    @AudreyGraceB Місяць тому

    Wow, great video, I'm glad I've just found your channel!

  • @sivaramarajusiv7826
    @sivaramarajusiv7826 2 роки тому

    Thank you Saldina, I learnt something from your videos.

  • @sarahalahmad9496
    @sarahalahmad9496 Рік тому +1

    💕💕💕💕 thanks a lot !

  • @cristina2516
    @cristina2516 Рік тому

    u really know how to explain things, good job!

  • @fayehill1225
    @fayehill1225 2 роки тому

    Thank you, really great video!

  • @higiniofuentes2551
    @higiniofuentes2551 11 місяців тому

    Thank you for this very useful video!

  • @artemioharoldperlaciosluqu5471
    @artemioharoldperlaciosluqu5471 2 роки тому +1

    Me encantan tus videos, muchas gracias :D

  • @amodpatwa1822
    @amodpatwa1822 2 роки тому +2

    You are amazing Saldina, this video was very nice. I prefer mostly unordered map over ordered map.
    And don't feel awkward about your favourite pokemon if you are 26, I'm 27 and my favourite pokemon is Pikachu ❤️ because he is very cute and sometimes very aggressive if he don't like anything

  • @diegoi1313
    @diegoi1313 11 місяців тому

    Loved your Pokédex Pikachu example!

  • @cr7johnChan
    @cr7johnChan 2 роки тому

    Thank You!!

  • @SibiAkaManiek
    @SibiAkaManiek 2 роки тому +2

    One of the most common situation is to erase element while iterating in the loop. In that case is so close to make mistake ;)

  • @Frammqooh1234
    @Frammqooh1234 2 роки тому

    Thank you for another video !!!!

  • @rushabhjain9158
    @rushabhjain9158 2 роки тому +1

    QUICK , PRECISE AND EASY !

  • @marzie5867
    @marzie5867 2 роки тому

    You're the best teacher ever
    First l saw one of your videos l had no ldea about computer
    But now l can write my own program
    I love you 😍 💗

    • @CodeBeauty
      @CodeBeauty  2 роки тому

      I'm so happy to hear that! 🥰

  • @victoradeola3807
    @victoradeola3807 Рік тому +1

    you are the Best. No one else comes close

    • @CodeBeauty
      @CodeBeauty  Рік тому

      Thank you so much, you are very kind person 🥰

  • @truecodeface
    @truecodeface 2 роки тому +1

    Thanks a lot from your clean codding , clear speaking , and you always brings each and every point from sidelines to TEXT.
    I
    💕💕💕 your Instructions always.
    but i wish to become a close colleague for you in the area of coding and programming for ever.
    so please try your best for shifting me from Afghanistan to your Homeland (Boss AND Herz).i want to work with you, i like working with you.

  • @kalidasbenny811
    @kalidasbenny811 5 місяців тому

    thanks a lot you are a life saver

  • @lightspd714
    @lightspd714 Рік тому

    Great presentation style, very informative! Also, pikachu is my fav

  • @abdourahamanediallo8877
    @abdourahamanediallo8877 2 роки тому +2

    I watch your videos and enjoy them very much. please can you make a video of a C++ programming project which covers all or almost all the themes of the C++ language

    • @CodeBeauty
      @CodeBeauty  2 роки тому

      Thank you, I will! ☺️🤗

  • @christofzellhofer7504
    @christofzellhofer7504 2 місяці тому

    Vielen Dank für deine Videos, du hast mir im Studium schon sehr geholfen! Beste Grüße aus Wien!👋
    Dein Deutsch ist sehr gut! 👌

  • @sheetalkhatri8106
    @sheetalkhatri8106 10 місяців тому

    Wow, you made it so interesting, great video

  • @yairfink2368
    @yairfink2368 2 роки тому +1

    thanks for all your videos, really like this program.

  • @alperenerdogan4602
    @alperenerdogan4602 Рік тому

    simple and nice explanation 👍

  • @fatehpreetsingh1440
    @fatehpreetsingh1440 2 роки тому +3

    Thank you for this tutorial

    • @CodeBeauty
      @CodeBeauty  2 роки тому +1

      You're welcome ☺️😺

  • @milo20060
    @milo20060 Рік тому

    I briefly remember on some random slide show in my second year uni about the maps. The teacher talked quite fast and I didn't pick it up.
    But now I kind of got it! Thanks!
    Oh and my favourite Pokemon.
    Well what first comes to my mind would be Charmander and it's final form Charizard. Used to have one as a soft toy ^^

  • @notionmakeit2888
    @notionmakeit2888 2 роки тому

    this is the best video for map

  • @amorbettaieb5329
    @amorbettaieb5329 Рік тому

    thank you a lot for this tutorial

  • @software2171
    @software2171 2 роки тому +3

    #include
    #include
    #include
    using namespace std;
    /*
    After Reading 'MAP in C++', thought about Google Map in C++..finally
    understand, could not search codebeauty location in this map.. :D
    */
    void fruits(){
    map dic;
    dic.insert(pair("1 kg apple", "die fruits "));
    dic.insert(pair("11 kg orange", "living fruits"));
    dic.insert(pair("7 kg berry", "newborn fruits"));
    dic.insert(pair("6 kg banna", "unborn fruits"));
    for (auto p : dic)
    cout

  • @KevinTempelx
    @KevinTempelx 2 роки тому

    Thanks!

  • @abdelaziz4329
    @abdelaziz4329 2 роки тому +7

    I have learnt English from you by practising of listening 😂

  • @sawomirbartoszko9385
    @sawomirbartoszko9385 2 роки тому

    interesting understandable consise without beating around the bush excellent

  • @luisfernando3405
    @luisfernando3405 Рік тому

    Is very good video to learn about this topic; Good job, 🎯

  • @johnsknows3135
    @johnsknows3135 Рік тому

    very good explanation thx!

  • @itx-zulqar
    @itx-zulqar 2 роки тому +3

    Thanks .....10hr C++ video. very very thanks

  • @shoniecaplan738
    @shoniecaplan738 2 роки тому

    perfect video👍

  • @Mathewx1111
    @Mathewx1111 2 роки тому

    Amazing video love it 🥰

  • @dolevdo
    @dolevdo 2 роки тому

    amazing thank u

  • @itx-zulqar
    @itx-zulqar 2 роки тому +2

    Thanks

  • @maheshvelugula8418
    @maheshvelugula8418 Рік тому +1

    I watch daily pokemon series videos, the way you explain and the example taken is very good, nice, thank you. 🥰😉

  • @fightforfitness2256
    @fightforfitness2256 Рік тому +1

    Thank u so much.

  • @aswin6261
    @aswin6261 Рік тому +1

    thank u sister

  • @swaroopsuriboyina9911
    @swaroopsuriboyina9911 2 роки тому

    thank you

  • @mulumbacephas5036
    @mulumbacephas5036 2 роки тому +1

    I was searching for copper and i ended up find gold nice vid

  • @begueivan3799
    @begueivan3799 2 роки тому +1

    You should explain how you set up your external terminal

  • @khors3075
    @khors3075 2 роки тому +1

    Hvala.

  • @austingrapes5455
    @austingrapes5455 Рік тому

    Using the pokedex example makes the lesson that much more fun.I really don't think scary face is an actual attack, I believe google is wrong, but it might be an attack in the newest versions.

  • @RohitKumar-np1vb
    @RohitKumar-np1vb 2 роки тому

    Love the content you upload🔥🔥
    I have been trying to grasp tree from a long time plzz make vedio's regarding trees.
    Love from INDIA

  • @pavankumarnitta0329
    @pavankumarnitta0329 2 роки тому

    Can you please post a full detailed long video on below two topics:
    Data structures using C++
    STL using C++

  • @vvkbees6473
    @vvkbees6473 Рік тому

    Спасибо.

  • @Sssilence3
    @Sssilence3 2 роки тому +1

    Always love ❤❤❤ your videos..
    Please make a video of “bit manipulation”... 🙏🙏
    I see lots of video of bit manipulation, but can't understand properly. 🙁🙁
    So please please one video of bit manipulation.

  • @mateoslab
    @mateoslab 2 роки тому +3

    i just learned about c++ containers 2 days ago so this video helps! How is a list different from a normal array? would it work to have a string array as the second data type of the map?

    • @ChrisCarlos64
      @ChrisCarlos64 2 роки тому

      One of the key differences is an array is fixed size versus a list that can grow and shrink in size. List, like other std containers (vector, queue, etc) know their size and have operational functions to get items at position, front, end, iterators, and so forth. When using normal arrays you cannot know the size, unless you use std::array which has some features like std containers, however array is still fixed size.
      Maps can hold any type of data for their keys and values. If you want the second to be string array, you can do that. Just remember that your string array has to be fixed in size or if you use a container it can grow and shrink over time, so it matters on what you need. You just need to think about what use would that array be for? Because the key gives you access to the array, but now accessing the elements in your string array requires some other search (like iterating and comparing the values).

  • @ibrahemnjr9924
    @ibrahemnjr9924 2 роки тому

    thanks

  • @farrelledric
    @farrelledric 3 місяці тому

    thanks miss

  • @SillyCatto
    @SillyCatto Рік тому +5

    Thanks a lot for such an easy and perfect explanations, also with interesting examples!😊
    Helps me a lot.
    We'd also love to have a video on set data structure please 🙂

  • @nde810
    @nde810 Рік тому

    This was a very clear explanation of the map concept, thank you for the hard work.
    PS : my favorite pokemon are Amphinobie, Pikachu, and Lukario :)

  • @superfloyd
    @superfloyd Рік тому +1

    tip : if the type is too complicated for readability, such as an iterator or a standard library type, then auto&& will magically bind to anything always.You can use it in for loop.

  • @who_thekaushik
    @who_thekaushik Рік тому

    Thanks mam👏

  • @JMac___
    @JMac___ 2 місяці тому

    u should discuss the underlying structure of the map and its implementation as well.

  • @Only-zeus
    @Only-zeus 2 роки тому +1

    Hey please upload tutorial play list about web development using C++

  • @connormckenna2396
    @connormckenna2396 2 роки тому

    This is a great video that's easily understood. However, I wish they would have explained the auto function within the for loop.

    • @CodeBeauty
      @CodeBeauty  2 роки тому

      Watch this video ua-cam.com/video/VNb3VLIu1PA/v-deo.html
      here I also use "auto" and there is an explanation for it

  • @drsumankhanal
    @drsumankhanal 7 місяців тому

    You teach so cool. Easy to follow? Can you make one on AVL and RB trees? How to create AVL trees, traverse?

  • @prigithjoseph7018
    @prigithjoseph7018 2 роки тому +1

    Hello do you have any plan for converting all your videos into book?
    You have created amazing videos friend.