Project: Coding your own database structure / binary tree in C

Sdílet
Vložit
  • čas přidán 29. 08. 2024
  • In this episode you will learn how to store data in memory. We will code a binary tree implementation which we'll later use as a basis for a hyper-efficient database.
    You will also improve your skills with regards to pointers, function pointers, macros and linked lists etc.
    Please check out my last video where I draw the binary tree visually and show my design • Designing your own Dat...

Komentáře • 32

  • @angelffg
    @angelffg Před 2 měsíci +1

    Great job Jonas! What a professional way to program!
    Excellent work!
    A hug!

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci +1

      Thanks Angel, take care, JB

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci

      @angelffg You left me hanging today at the stream so I have decided to remove you as moderator and chief moderator. You have done a great job before and for that I thank you, but from now on I need somebody I can trust. I hope you understand, JB

    • @angelffg
      @angelffg Před 2 měsíci

      @@dr-Jonas-Birch Jonas, today the power went out where I was and for that reason I was absent while I was solving. Then I rejoined and continued accompanying you throughout the presentation.
      Likewise, I respect your decision. It was a pleasure to help someone with your technical level.
      A hug!

  • @minma02262
    @minma02262 Před 2 měsíci +2

    Thank you for your hardwork. Great work. 🙏

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci +1

      Thanks Minma, take care and see you Friday, JB

  • @Lamya_1
    @Lamya_1 Před 2 měsíci +4

    Hey JB, can you please make a tutorial series on how to create a compiler in c for a custom programming language

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci +3

      Hi Lamya. I don't think C is very suitable for making a compiler, Im however considering doing the very same in the language of Haskell. JB

    • @Lamya_1
      @Lamya_1 Před 2 měsíci +1

      @@dr-Jonas-Birch that's nice, when can we expect those series

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci +1

      Some time during the summer, I suppose. It's a good idea. You code Hs? JB

    • @Lamya_1
      @Lamya_1 Před 2 měsíci +1

      @@dr-Jonas-Birch nope i come from javascript background, teaching myself c from your channel

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci +2

      Cool, glad to hear it. JB

  • @AmanKumar-jk1qu
    @AmanKumar-jk1qu Před 2 měsíci +1

    thank you sir for all the hard work that you do for us looking forward to the live stream!!

  • @dheerajreddy3601
    @dheerajreddy3601 Před 2 měsíci +1

    Thanks for the video! What’s your opinion on test driven dev? So many pointers and string copying might eventually lead to a some hard to find bug somewhere.

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci

      You're welcome! As I see it, TDD by definition makes your program do only the bare minimum to satisfy the tests. I think it might be a way to go in a large projects/companies with many junior devs.
      But in this case, I know excactly what every part of my code does and despite the large number of pointers and copied strings I know there's no bugs. That kind of knowledge comes with experience.
      One could use a safe string library though, to help out. Check my video "Unhackable code", for more info. JB

  • @NimaqAlizadeh
    @NimaqAlizadeh Před 2 měsíci +1

    Nice. Tnx🎉

  • @dheerajreddy3601
    @dheerajreddy3601 Před 2 měsíci +1

    Hi Jonas, Is there any reason you haven't used the standard integer types like uint16_t, uint32_t located in stdint.h?

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před 2 měsíci

      Yes I don't like underscores in variables :) JB

  • @GG-oh5wo
    @GG-oh5wo Před měsícem

    I believe you made a small mistake in your create_leaf function. Instead of doing new->west = (!l) ? (Node*)parent : (Leaf*)l it should have been new->up…. I think it makes more sense to link the leaf to its parent or parent leaf that way

    • @GG-oh5wo
      @GG-oh5wo Před měsícem

      Just a logical mistake imo

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před měsícem

      Hi gg. Thank you, but the parent of the first leaf of that branch is the node right west of it. The parent of the 2nd, 3rd and so on is the leaf right west of it. Even though I only call nodes "parent", but you get the idea. The western links are the "go backwards" part of the linked lists, and I dont think struct s_leaf even has a northern link.
      JB

    • @GG-oh5wo
      @GG-oh5wo Před měsícem

      @@dr-Jonas-Birch Hi, I dont understand this: "but the parent of the first leaf of that branch is the node right west of it" if we think it as a triangle, the node is at the top and the leaf (in your logic) is on the bottom right (southeast) position of the node (aka parent) no? Like direction wise, right is right and west is left so it does not really click in my head.

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před měsícem +1

      Think of the nodes as a line from the top right corner all the way to the bottom left, always linking downwards to the southwest.
      Then each node has an arm, a straight horizontal line to the right. This branch is a long arm which contains the leaves. The 1st leaf connects to the node and the 2nd leaf connects to the 1st leaf, and so on and so forth.
      JB

  • @araz911
    @araz911 Před měsícem

    bro when u start coding its like going back -50 years😂 use modern libs for C and switch to professional editor like VS, and also remove that open source bloatware like kernel, vim, they eat memory😁

    • @dr-Jonas-Birch
      @dr-Jonas-Birch  Před měsícem +1

      I have 384 gigs of ram in that machine so Im not worried. And I dont use other ppl's code because that is not programming. I have actually switched to vscode+vim motions, which is kinda great. Im glad you like my channel, take care. JB

  • @Kyoz
    @Kyoz Před 2 měsíci +1

    🤍