Array of objects Algorithms - Search, Sort, Reverse, Max, Min, Custom methods

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 มิ.ย. 2024
  • In this video, you will learn about algorithms and the most common operations used with arrays of objects. I will teach you how to perform searches for specific elements inside an array. You will also learn how to sort and reverse arrays, as well as how to find the minimum and maximum elements using specific criteria. To define these criteria, I'll teach you how to write custom methods for comparing elements within an array.
    As usual, there will be a task for you at the end to test what you have learned from this video.
    📚 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.
    ☕ 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! ❤️😇
    Related videos:
    Array Data Structure (for absolute beginners) - • DATA STRUCTURES - How ...
    Array of Objects Introduction - • Arrays of objects - In...
    Dynamic Array of Objects - • Dynamic Arrays of Obje...
    Classes and Objects for Beginners - • C++ OOP - Introduction...
    Types of Constructors - • OOP Constructors - Typ...
    Contents:
    00:00 - What you will learn in this video
    01:47 - Explaining initial code
    02:47 - Creating and initializing array of objects
    04:09 - Algorithm for searching objects in the array
    07:55 - Algorithm for sorting objects in the array
    10:26 - Implementing custom method for comparing objects in array
    13:14 - Good programming practices - passing data by reference vs passing data by value
    15:14 - Implementing another custom method for comparing objects in array
    16:02 - ASCII code explained
    17:26 - Reversing array
    18:20 - Finding max element in array
    20:10 - Finding min element in array
    21:07 - Practical task for you
    Add me on other platforms for more educational content:
    Instagram 📸 - / truecodebeauty
    Twitter 🐦- / truecodebeauty
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 56

  • @CodeBeauty
    @CodeBeauty  10 หลายเดือนก่อน +15

    📚 Learn programming 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.

  • @milkamilkica1935
    @milkamilkica1935 10 หลายเดือนก่อน +5

    I'm a student and you're the only reason why I get good grades on my exams

  • @codeoasis1180
    @codeoasis1180 10 หลายเดือนก่อน +4

    best explanation of arrays and algorithms on that i could find on youtube

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      always good to hear :D

  • @dundyd3612
    @dundyd3612 10 หลายเดือนก่อน +3

    I'm so happy that I found your channel. I can honesty say that you changed my life ❤❤

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      I'm so glad!

  • @hilgicamala2520
    @hilgicamala2520 10 หลายเดือนก่อน +2

    thank you saldina, this is the video that I've been searching for

  • @user-bc9vi2sl5k
    @user-bc9vi2sl5k 10 หลายเดือนก่อน +3

    I am sure it is going to be amazing class

  • @eliasrodriues6614
    @eliasrodriues6614 10 หลายเดือนก่อน +4

    Beautiful and smart teacher

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      You are so kind

  • @amelccc
    @amelccc 10 หลายเดือนก่อน +6

    great job as always 👌👌

  • @nv9usb381
    @nv9usb381 10 หลายเดือนก่อน +5

    Saldina should be grade 10 in the example 🥰

  • @phoebewell3653
    @phoebewell3653 10 หลายเดือนก่อน +3

    I love the task at the end of the video. Very good for practicing

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      Glad you liked it!

  • @marym9003
    @marym9003 10 หลายเดือนก่อน +2

    this video is a treasure

  • @user-sw8bq1rk9c
    @user-sw8bq1rk9c 10 หลายเดือนก่อน +3

    great job, thank you Saldina, this is very helpful

  • @OzzFan1000
    @OzzFan1000 10 หลายเดือนก่อน +2

    The tips about using pass by reference was most helpful to me. I need to play around with that some more to fully understand it. Thanks!

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน +1

      Certainly, practice is everything and curiosity is always rewarded (in programming at least :D)

  • @user-lu6kv9kr8u
    @user-lu6kv9kr8u 10 หลายเดือนก่อน +4

    right on point, as usual, clear and concise, precious :)

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      Thank you kindly!

  • @deanmorrison6254
    @deanmorrison6254 10 หลายเดือนก่อน +4

    very helpful, thank you so much

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      You're so welcome!

  • @muatzdaw8283
    @muatzdaw8283 10 หลายเดือนก่อน +1

    The best teacher ever, thank you for making anything easy 🤗🤗

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      You're very welcome!

  • @raohammadraza7056
    @raohammadraza7056 10 หลายเดือนก่อน

    superb Teacher thanks you so much.
    Great job good teaching method

  • @bicycleninja1685
    @bicycleninja1685 7 หลายเดือนก่อน

    Thanks, anything regarding data wrangling is interesting to me

  • @austineodhiambo4095
    @austineodhiambo4095 8 หลายเดือนก่อน +1

    You always inspire me through programming.

    • @CodeBeauty
      @CodeBeauty  8 หลายเดือนก่อน

      🚀✨️

  • @muhmedgamal5841
    @muhmedgamal5841 3 วันที่ผ่านมา

    thank you

  • @valjo02
    @valjo02 10 หลายเดือนก่อน +2

    Excellent explanation and very good homework . Keep up doing new videos Saldina. I am very keen on programming 👍

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน +1

      Use this link to sign up for my practical programming course and I will send you notification with the discount once it is published. I gave my best to make it as good as possible :)
      Cheers.

  • @ktoscos4546
    @ktoscos4546 10 หลายเดือนก่อน +1

    Name of channel match perfectly

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      Thank you 🥰❤️

  • @hsngraphics8228
    @hsngraphics8228 10 หลายเดือนก่อน +1

    thanks for your support

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน +1

      Always welcome

  • @avion85
    @avion85 10 หลายเดือนก่อน

    Here's a new video idea: the same topics but using modern C++ features like ranges and lambdas. It would make for a nice contrast while making the code smaller, simpler and safer.

  • @georgebentley-ricardo9445
    @georgebentley-ricardo9445 10 หลายเดือนก่อน

    Huge thumbs up 🤠👍

  • @user-en9bu9lg1g
    @user-en9bu9lg1g 10 หลายเดือนก่อน +1

    Hi saldina.. Any idea of starting advanced topics like mutex, semaphores, process sync topics? Most awaiting.

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      I just added all of these topics to my too list. Thanks for the suggestions 🥰

  • @nevram0101
    @nevram0101 10 หลายเดือนก่อน +1

    Thankyou

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน

      You’re welcome 😊

  • @nissum5179
    @nissum5179 10 หลายเดือนก่อน

    After completing your video, something is definitely hard but its not the concept of array 😳❤

  • @omerhusen906
    @omerhusen906 10 หลายเดือนก่อน +3

    ❤❤

  • @Alexander-iq5yq
    @Alexander-iq5yq 3 หลายเดือนก่อน

    I am curious how "sort(students, student+5, compareByGrade)" works when compareByGrade would seem only to compare one element to the next. It would require many passes to sort the data, right? Is that what is happening automatically behind the scenes in sort(), or do I not understand?

  • @dvongrad
    @dvongrad 9 หลายเดือนก่อน

    Other things to consider in searching and sorting are what to do if multiple students with the same name exist in a search, searching for grades above or below a certain value, and secondary sorts like descending grades sorted alphabetically by name for grades that occur more than once. Perhaps these concepts are beyond the scope of "beginner" tutorials...

  • @omarious
    @omarious 10 หลายเดือนก่อน +2

    Saldana has 7.2 and Alice has 10. Alice’s score was updated.

    • @CodeBeauty
      @CodeBeauty  10 หลายเดือนก่อน +1

      Saldina* :D

    • @omarious
      @omarious 10 หลายเดือนก่อน

      @@CodeBeauty Saldina! I stand corrected… my apologies.
      Blaming: autocorrect!

  • @tusharghosh5432
    @tusharghosh5432 6 หลายเดือนก่อน

    I have a doubt. When you call the global function compareByGrade from main function, you actually did not pass it with parenthesis how is it possible?

  • @rezafarokh8637
    @rezafarokh8637 10 หลายเดือนก่อน +1

    Comment

  • @wilgarcia1
    @wilgarcia1 10 หลายเดือนก่อน +1

    😻😻😻😻😻😻😻😻😻

  • @Kingston7685
    @Kingston7685 10 หลายเดือนก่อน +2

    Tum kya mila

  • @bharathap780
    @bharathap780 10 หลายเดือนก่อน

    are there solution for your homework ? because i want to compare my solution to yours

  • @nicholaskomsa1777
    @nicholaskomsa1777 หลายเดือนก่อน

    Here's how I might do that:

    struct Student {
    std::string mName;
    bool mGenderMale{ false };
    int mGrade{ 0 };
    Student(const std::string& name, bool isGenderMale, int grade)
    : mName(name), mGenderMale(isGenderMale), mGrade(grade)
    {}
    };
    std::array students = {
    Student{"John", true, 20}
    , {"Jane", false, 21}
    , {"Jack", true, 22}
    , {"jason", true, 23}
    , {"nick", true, 24}
    , {"nancy", false, 25}
    };
    std::string studentNameToFind = "Jane";
    auto studentFound = std::find_if(std::execution::seq, students.begin(), students.end(), [&](const auto& student) {
    return student.mName == studentNameToFind;
    });
    if (studentFound != students.end()) {
    auto& [name, isMale, grade] = *studentFound;
    std::cout b.mGrade;
    });
    auto& bestGrade = students.front();
    auto& worstGrade = students.back();
    //now sort by gender and grade
    //females are in the front of the array and males are at the end
    std::sort(std::execution::par, students.begin(), students.end(), [](const auto& a, const auto& b) {
    return a.mGenderMale < b.mGenderMale || a.mGenderMale b.mGrade;
    });
    for (auto& student : students) {
    std::cout