Это видео недоступно.
Сожалеем об этом.

Learning a new approach to Recursion | Rust Language

Поделиться
HTML-код
  • Опубликовано: 13 авг 2024
  • Taking a new approach to learning recursion. I studied a few tutorials and videos but found that this technique from the book "Think like a programmer" helped a lot. By making an iterative solution first and the altering it to recursion using the "last part" / "last element" is quite a useful way to approach the problem.
    I tried the general idea in Python first and debugged it in VScode debugger and then converted it to Rust, as you can see in this video
    -- chapters --
    00:00 intro
    01:15 iterative version
    01:59 recursive code
    05:03 testing the code
    Think Like A Programmer :
    nostarch.com/t...
    Link to article and PythonTutor example can be found here:
    redandgreen.co...
    🟩 -----------------------------------------------------------------------------------------------------
    Webdock Linux Hosting : webdock.io/en?...
    🟩 -----------------------------------------------------------------------------------------------------
    Nostr
    ---------
    @RngWeb
    findthatbit@iris.to
    findthatbit.info/
    redandgreen.co...
    #rustlang #SurrealDB #learningrust

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

  • @flyingbluelion
    @flyingbluelion 4 месяца назад +1

    a better issue for recursion is the memory and time overhead compared to direct code and what kinds of problems benefit form a recursive solution. "Towers of Hanoi" is a good example.

    • @learning_rust
      @learning_rust  4 месяца назад

      Ah, yes, that's on the list, I'll delve into that in due course. My reason for looking at recursion is to understand and use trees more👍

  • @s14vc
    @s14vc 4 месяца назад +1

    I thought that recursion was impossible in rust because of the ownership lol

    • @learning_rust
      @learning_rust  4 месяца назад

      Yeah, you do need to use a Box pointer with link lists, but (so far) recursion is ok. This example was ok as all on the stack (i32) as I understand.