Rosalind Problems: Fibonacci, Rabbits and Recurrence Relations

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 20

  • @michaelmoore7568
    @michaelmoore7568 Месяц назад +1

    this is one of the most information rich tutorial channels that I've ever seen

    • @rebelScience
      @rebelScience  Месяц назад

      Thank you so much! Glad you find the content valuable!

  • @kroes3236
    @kroes3236 4 года назад +9

    I'm enjoying this series so much! I had already done some of the problems but it's very nice to see your explanation and programming.

  • @dlearhasan8899
    @dlearhasan8899 4 года назад +2

    Dear RebelCoder
    this is my coding to solve Rabbits and Recurrence relations
    month_total_pair = {1: 1, 2: 1}
    n = int(input("Please Enter Month! : N = "))
    k = int(input("Please Enter litter of rabbit pairs! : k = "))
    if n == 1 or n == 2:
    print(month_total_pair[n])
    else:
    for x in range(3, 41):
    total_pair = month_total_pair[x-1] + month_total_pair[x-2] * k
    month_total_pair.update({x: total_pair})
    print(month_total_pair[n])

  • @rusbiology3460
    @rusbiology3460 4 года назад +3

    спасибо за видео!

  • @sohamshirolkar
    @sohamshirolkar 4 года назад +1

    great explanation..keep up the good work..

  • @LumTheAlien
    @LumTheAlien Год назад

    How do you do a bulk rename at 6:59?
    edit:
    Okay I see you do it by right clicking on the word you wish to rename and hitting rename symbol.

  • @ВасяИванов-щ6з
    @ВасяИванов-щ6з 2 года назад +1

    it works for final "children" value count, but matching visualisation and code "parents" looks little bit odd.

    • @ВасяИванов-щ6з
      @ВасяИванов-щ6з 2 года назад +1

      my point is:
      1) initial values: children, parents = 1, 0
      2) inside for loop: children, parents = parents * offspring, children + parents
      3) return (children + parents)

    • @elshroomness
      @elshroomness 2 года назад +1

      @@ВасяИванов-щ6з ohhh I had a question about this! thank you!

  • @rusbiology3460
    @rusbiology3460 4 года назад +3

    Do you mind if I translate your videos into Russian and upload them to RUclips?

  • @lstein8670
    @lstein8670 4 года назад +3

    are you taking a break from making video?

    • @rebelScience
      @rebelScience  4 года назад +6

      Nope. I was working on something else, related to Bioinformatics. Expect new videos very soon.

    • @kroes3236
      @kroes3236 4 года назад +2

      @@rebelScience nice

  • @elshroomness
    @elshroomness 2 года назад

    why did you start with parent = 1, and child = 1, when in the first month there is only 1 child and 0 parents?

    • @elshroomness
      @elshroomness 2 года назад +1

      apparently there are different ways of counting the resulting bunnies after a given number of months. Below is the code that was mentioned in the video that starts with parent and children starting at 1.
      def fib_bunnies2(months,offspring):
      parent,child = 1,1
      for itr in range(months - 1):
      child,parent = parent, parent + (child * offspring)
      return child
      fib_bunnies2(5,2)
      However, this implementation does not reflect the diagram that was show below the code in the video. The code below shows how the code should be written to match the diagram:
      def fib_bunnies(months, offspring):
      child, parents = 1, 0
      for itr in range(months - 1):
      child, parents = parents * offspring, child + parents
      return (child + parents)
      fib_bunnies(5,2)
      Notice that inside the for loop there is different ways of incrementing the child and parent variables to result to the same result.
      credit goes to @Вася Иванов for their comment in this video and helping realize a hidden nuance in recursion. Thanks!

  • @alauddinany457
    @alauddinany457 4 года назад +1

    go ahead