Project: Coding your own database structure / binary tree in C
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...
Great job Jonas! What a professional way to program!
Excellent work!
A hug!
Thanks Angel, take care, JB
@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
@@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!
Thank you for your hardwork. Great work. 🙏
Thanks Minma, take care and see you Friday, JB
Hey JB, can you please make a tutorial series on how to create a compiler in c for a custom programming language
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
@@dr-Jonas-Birch that's nice, when can we expect those series
Some time during the summer, I suppose. It's a good idea. You code Hs? JB
@@dr-Jonas-Birch nope i come from javascript background, teaching myself c from your channel
Cool, glad to hear it. JB
thank you sir for all the hard work that you do for us looking forward to the live stream!!
Thank you my friend, see you there. JB
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.
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
Nice. Tnx🎉
You're welcome Nimaq, take care. JB
Hi Jonas, Is there any reason you haven't used the standard integer types like uint16_t, uint32_t located in stdint.h?
Yes I don't like underscores in variables :) JB
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
Just a logical mistake imo
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
@@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.
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
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😁
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, glad you liked it, take care, JB