Multiple Return Values: Unlocking the Power of Recursive Functions | Recursion Series

Поділитися
Вставка
  • Опубліковано 15 лип 2024
  • In this video, we dive into the fascinating world of recursive functions and learn how to return multiple values from them. Recursive functions are powerful tools that call themselves repeatedly to solve complex problems by breaking them down into smaller, more manageable subproblems. Returning multiple values from a recursive function can be particularly useful when you need to gather and analyze various pieces of information during the recursive process.
    Source code repository:
    github.com/williamfiset/algor...
    Video slides:
    github.com/williamfiset/algor...
    Personal website:
    williamfiset.com

КОМЕНТАРІ • 14

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

    Happy to see you back🎉 keep posting videos, learned lot from this channel.

  • @aa-xn5hc
    @aa-xn5hc Рік тому

    Loving your amazing videos

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

    Its been quite a long time eh ? Welcome back!!

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

    Hello. Happy to see you back. I have always wondered about the tools you are using to produce your videos. Could you please share the tools and software you used to produce your videos?

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

    what if my language 'c++' don't support null, what value should i return at base case ?

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

      pair compare(pair pr1, pair pr2)
      {
      if (pr1.second > pr2.second)
      return pr1;
      return pr2;
      }
      pair maximum_func(vector vec, int index)
      {
      if (index == (int)vec.size() - 1)
      {
      pair pr;
      pr.first = (int)vec.size() - 1;
      pr.second = vec[(int)vec.size() - 1];
      return pr;
      }
      pair sub;
      sub.first = index;
      sub.second = vec[index];
      return compare(sub, maximum_func(vec, index + 1));
      }
      pair maximum(vector vec)
      {
      return maximum_func(vec, 0);
      }
      int main()
      {
      cout

    • @WilliamFiset-videos
      @WilliamFiset-videos  Рік тому

      You could use nullptr? Or an int wrapper object

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

    the slides not exist in githup

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

      i found it , but why you upload the slides with "key" extension 😂

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

    Surely, multiple return values have to be bad practice in most cases?! Let's exclude the very odd occasion where this might be a good idea.

    • @WilliamFiset-videos
      @WilliamFiset-videos  Рік тому +2

      It's certainly seldom used. I rarely use multiple return values unless it's for recreational code. In practice if you do have to return multiple values a data object is typically the best way IMO.

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

    😈 *Promo SM*