I have a favor to ask! RUclips have put adds in this video (even though I'm not monetizing it). I liked my video being ads free, which was why I don't ask for likes or subscribes in my videos. But ads happened beyond my control. If you found this video helpful, please click subscribe to support, that would be so wholesome! I put a lot of time and effort in my videos (a week for push_swap) to help people and would love a little kindness in return. Thank you for you! ♥️
I am now 3 months in 42....and this is the best Tutorial i have ever seen until today....for a 42 project to understand whats going on. You do it perfect in a slow and smooth mode to help us to understand. Thank you for that and please do more of that. So good. 😀👍🙏
It's a great video that was much needed for the community. Thank you for stepping forward and taking action. I appreciate the shoutout, and you pronounced my name 100% correctly. Thank you Thuy! 😃🙏
Thanks so much friend! You helped me massively with get_next_line (despite it not being English) and I linked your video in my github for it. I didn't know how to reach out to you, but I am so grateful for you!
Thanks so much for the video! It's really helpful, I am in the beginning stages of my project and it has helped me to have a clearer vision of how I should approach it. And for what it is worth, I really appreciate the calmness of your voice, there are already enough high speed and over stimulating videos all around 😄
Thank u so much for the explanation I'm from 42 RIO, you helped me a lot!!!! 💖 I loved you're videos they're really well ilustrated pleeeese keep doin' it💕
Hi there! Awesome video, thanks!! I just have one question: at the 14:00min you say that the cost of putting the number 25 from STACK A to STACK B is 0, which seems inaccurate to me, because the cost is 1. One operation is needed to push the number 25 to STACK B. Is it not?
Hello, thank you for the tutorial very useful, although i have a question. Why in minute 15:45 you say that the pushcost of 7 is 3 when we can make rr and ra so 2 operations to put both in the top. Thank you in advance.
Hello, thank you for dropping by! At that state of configuration, the push cost for 7 is 3 because we need to rr twice in stack a: 1st rr to bring 42 to top, 2nd rr to bring 7 to top. Let me know if I've missed something or if I've understood your question incorrectly and we'll try again, good luck friend! 😊
@@thuggonaut ok now i understand but why we do not use only rotate in this case, so we make two moves till with 1 move we rotate both and with the other only a and we have 7 and 0 at the top. I make this think because i tried to fallow a logic on my code (not tested yet) where i add 1 to the median. Anyway thank you for your help and sorry for my english.
this video was so helpful !! thank you for making it :) may i know what application you used to create this video? what did you use to screen record, and to create the explanation slides in the beginning ? and to compile the clips together? x0
I'm glad, and you're welcome 😊😊 Of course! I used Microsoft Powerpoint for the slides, and then windows capture to record the screen. I didn't need to compile things together because I just screen recorded the whole thing. If you have windows though, microsoft clipchamp is good for video editing, hope that helps!
Hello friend, thank you for passing by, and your kindness. I believe it does. There may be the occasional case where it returns higher instructions, but I suggest running the case a few times (also recommended in the evals), and it should give you the desired average.
I have another question. Why is mutable string important in split? When I try to do it with my ft_split in the input "./push_swap -" i encounter leak as still reachable but your split doesn't have any leaks. I couldn't figure out why is it different.
Hi, sorry for the late reply! No, we only need to make sure [b] node is pushed on to the correct [a] node, so we move it (the [a] node) to the top before doing so @16:42
i'm not sure if i'm missing something really obvious. But i think at the point where you're explaining the actual coding you say you covered already what 'a ''target node" is. But earlier in the video when talking about nodes you say you will explain it later....i cannot find where in the video it is actually explained.
Hello, im still at b2br, i dont really like that project so during my free time i was wondering if i should start learning how to do the next project, push swap. I didnt watch the vid yet, do you recommand me to try push swap alone and then look at ur vid, or watching it first is a good way to start it well?
Hi! Thanks for visiting :) B2BR is tedious, but I liked that I didn't have to "think" much with it haha. Always great to have a go at it first, for sure. You could even watch the first half which explains visually how the swap/push operations and linked lists work, then have a go at coding it. Even if your chosen sort algorithm is different to mine, it can be transferrable. Good luck with 42!
I have a question, your push commands like pa pb takes boolean as parameters but they are always false. Is there a specific reason why dont they just print when they are called?
Such a fair question! The bools were added as an option to print the commands, or not, which can be useful for debugging purposes. In hindsight though, going back to the scattered bools to change its value is tedious, and I wasn't experienced with global variables or custom macros. I'd use custom macros instead, something like '#define ENABLE_PRINT 1' in the .h file
Hello, thanks for visiting! We need to do it twice because the algorithm requires us to push the first two nodes to stack [b] (if [a] has >4 nodes), but only push the first node if [a] has 4 nodes.
Hello, thanks for your feedback 🙏 I didn't test for memory leaks but knew that could be the case, what you've written. I chose the easiest route possible to get the project done and didn't want to worry about it too much as long as it worked, and so I created a different split() to ft_split(). split() is only responsible for splitting a string, and returns NULL at any point where malloc is unsuccessful. init_stack_a() is responsible for appending nodes if there are no errors. If there are errors the stack is freed. Thanks again and good luck!
was you able to solve that matter? cause i have been spending hours working on that part to prevent the leak but i solved half of it only! if you did please share it and thanks in advance
@@Ay_140 you have to free the result of ft_split if used (it should be used only if you have one argument) if your variable is **splited_str, then you free(splited_str[0]) and then free(splited_str[1]) until splited_str[i] is NULL, and then you free(splited_str)
@@RiDOU-p2g i have done this but im still getting one block of memory not freed, searched everywhere but couldn’t fix it 😓 When i fix it it affects the behavior of the full function. If you did it right share your git hub solution if you don’t mind 🙏🏻
@@Ay_140 I'm sorry you had to do this as my code has flaws! Someone else opened an issue in my GitHub regarding this, I'm wondering if that will shed any helpful light as well. Please do let me know how you go to solve it 🙏🏼 Also thanks @user-vh6rl1se8e for highlighting the leak and solution 😊
Hello 😊 I won't be able to anytime soon, but I found this video super helpful m.ruclips.net/video/-Mt2FdJjVno/видео.html or check out my guide on the GitHub link that scored me 125%
I tested your code and it has a memory leak when you do a test that you expect the output to be "Error", example: "./push_swap "2 5 1 4 3 32 -42 ab"", I'm trying to solve it but I wasn't able to do so, if someone knows how to, please help me
Hello! Thank you for visiting, and for this feedback, my program is definitely flawed! I'm glad you solved the issue, please share how so if you've the time 😊
I have a favor to ask!
RUclips have put adds in this video (even though I'm not monetizing it). I liked my video being ads free, which was why I don't ask for likes or subscribes in my videos. But ads happened beyond my control.
If you found this video helpful, please click subscribe to support, that would be so wholesome! I put a lot of time and effort in my videos (a week for push_swap) to help people and would love a little kindness in return.
Thank you for you! ♥️
I am now 3 months in 42....and this is the best Tutorial i have ever seen until today....for a 42 project to understand whats going on. You do it perfect in a slow and smooth mode to help us to understand. Thank you for that and please do more of that. So good. 😀👍🙏
Thank you for your kind words and feedback. It makes my heart so glad you found it helpful 😊
It's a great video that was much needed for the community. Thank you for stepping forward and taking action. I appreciate the shoutout, and you pronounced my name 100% correctly. Thank you Thuy! 😃🙏
I so appreciate you!
Amazing explanation 🔥 congrats, keep it up your channel will explode ! 👊🏻
Thank you forever!
Yay, more 42 tutorials ! 🎉 And this one must have been a lot of work. I really like how you structured the video and visuals, it’s great 👏🏻
Thanks so much friend! You helped me massively with get_next_line (despite it not being English) and I linked your video in my github for it. I didn't know how to reach out to you, but I am so grateful for you!
@@thuggonautThank you so much for the kind words, I’m really happy the GNL video helped !
I didn't know it was you!!! When I figured it out, I was like: "Let's go, 42 Adelaide". Caring is sharing. Thanks so much for your effort.
Haha 😊
I hope it was helpful. See you around!
I am currently working on this project and this is tremendously helpful. Thank you!❤
Thank you for your kind words 😊
This is great. Being someone at 42 and had taught before it would make way more sense why you want to do something and then how you do. Great work.
Thank you for the kindness 😊
Thanks so much for the video! It's really helpful, I am in the beginning stages of my project and it has helped me to have a clearer vision of how I should approach it. And for what it is worth, I really appreciate the calmness of your voice, there are already enough high speed and over stimulating videos all around 😄
Thank you for your kindness! I'm so glad it can be helpful for you. All the best with aceing it😊
@@thuggonaut thanks!! 🥰
this video carried most of the push_swap projects at 42 X) SOOO well explained thank you !
Thank you so much for the kind words 💛💛
I passed this project by watching this video, thank you so much.
Amazing work, yay!
Amazing work on this tutorial.
It was very well structured and the visual aid was really well thought. Thanks for your work!
@@arturcarvalho7484 you are so welcome and thank you for the kind words! Good luck with your project! 😊
Thank u so much for the explanation I'm from 42 RIO, you helped me a lot!!!! 💖 I loved you're videos they're really well ilustrated pleeeese keep doin' it💕
Thank you so much friend, I appreciate you 😊
thanks for the help ! great video
perfect tutorial keep it up
Thank you! Cheers!
thank you for the video now i understand it better😁
@@fabocas you're welcome friend, and good luck! 😊
@@thuggonaut trying.. to not be blackholed😭😂
Great video!
Thank you! 😊
min 19:18
median is 7. so to bring 7 to top we will need to ra() twice or rra() three times so better use ra() if (target node >= median).
yes, but since index starts in 0 you get ra twice ;)
Amazing explanation!!! Helped me a lot
Thank you friend! That makes me happy 😊
Hi there! Awesome video, thanks!!
I just have one question: at the 14:00min you say that the cost of putting the number 25 from STACK A to STACK B is 0, which seems inaccurate to me, because the cost is 1. One operation is needed to push the number 25 to STACK B. Is it not?
It technically cost one more but because it is the case of every numbers it is voluntary ignored
@@corentinlt7859 Ok, thank you!
Awesome video, thank you!
Thank you friend!
Hello, thank you for the tutorial very useful, although i have a question.
Why in minute 15:45 you say that the pushcost of 7 is 3 when we can make rr and ra so 2 operations to put both in the top. Thank you in advance.
Hello, thank you for dropping by!
At that state of configuration, the push cost for 7 is 3 because we need to rr twice in stack a: 1st rr to bring 42 to top, 2nd rr to bring 7 to top. Let me know if I've missed something or if I've understood your question incorrectly and we'll try again, good luck friend! 😊
@@thuggonaut ok now i understand but why we do not use only rotate in this case, so we make two moves till with 1 move we rotate both and with the other only a and we have 7 and 0 at the top.
I make this think because i tried to fallow a logic on my code (not tested yet) where i add 1 to the median. Anyway thank you for your help and sorry for my english.
this video was so helpful !! thank you for making it :)
may i know what application you used to create this video? what did you use to screen record, and to create the explanation slides in the beginning ? and to compile the clips together? x0
I'm glad, and you're welcome 😊😊
Of course! I used Microsoft Powerpoint for the slides, and then windows capture to record the screen. I didn't need to compile things together because I just screen recorded the whole thing. If you have windows though, microsoft clipchamp is good for video editing, hope that helps!
I like it a lot! 👍
hey. Does this implementation fall below the limit for 100 and 500 numbers? Your explanation is very educational and helped me a lot.
Hello friend, thank you for passing by, and your kindness.
I believe it does. There may be the occasional case where it returns higher instructions, but I suggest running the case a few times (also recommended in the evals), and it should give you the desired average.
I have another question. Why is mutable string important in split? When I try to do it with my ft_split in the input "./push_swap -" i encounter leak as still reachable but your split doesn't have any leaks. I couldn't figure out why is it different.
Did you have any luck? I'll try to get back to you as soon as I can! The black hole is creepin on me 😅
u a legend, W
Thanks so much bro!
Hello again, i have a question do we need to calculate the cheapest when we have to push from stack_b to stack_a ?
Hi, sorry for the late reply! No, we only need to make sure [b] node is pushed on to the correct [a] node, so we move it (the [a] node) to the top before doing so @16:42
nice
i'm not sure if i'm missing something really obvious. But i think at the point where you're explaining the actual coding you say you covered already what 'a ''target node" is. But earlier in the video when talking about nodes you say you will explain it later....i cannot find where in the video it is actually explained.
Hey friend! I explain target_nodes in the animation @10:20 Hope it helps 😊
Hello, im still at b2br, i dont really like that project so during my free time i was wondering if i should start learning how to do the next project, push swap. I didnt watch the vid yet, do you recommand me to try push swap alone and then look at ur vid, or watching it first is a good way to start it well?
Hi! Thanks for visiting :)
B2BR is tedious, but I liked that I didn't have to "think" much with it haha.
Always great to have a go at it first, for sure. You could even watch the first half which explains visually how the swap/push operations and linked lists work, then have a go at coding it. Even if your chosen sort algorithm is different to mine, it can be transferrable. Good luck with 42!
I have a question, your push commands like pa pb takes boolean as parameters but they are always false. Is there a specific reason why dont they just print when they are called?
Such a fair question! The bools were added as an option to print the commands, or not, which can be useful for debugging purposes. In hindsight though, going back to the scattered bools to change its value is tedious, and I wasn't experienced with global variables or custom macros. I'd use custom macros instead, something like '#define ENABLE_PRINT 1' in the .h file
min 34:26 line 40 - 42. why to we need the "if check" twice ?
Hello, thanks for visiting! We need to do it twice because the algorithm requires us to push the first two nodes to stack [b] (if [a] has >4 nodes), but only push the first node if [a] has 4 nodes.
Your code has a memory leak if you put all your arguments into one argument (due to the result of ft_split not being freed)
Hello, thanks for your feedback 🙏
I didn't test for memory leaks but knew that could be the case, what you've written. I chose the easiest route possible to get the project done and didn't want to worry about it too much as long as it worked, and so I created a different split() to ft_split(). split() is only responsible for splitting a string, and returns NULL at any point where malloc is unsuccessful. init_stack_a() is responsible for appending nodes if there are no errors. If there are errors the stack is freed.
Thanks again and good luck!
was you able to solve that matter? cause i have been spending hours working on that part to prevent the leak but i solved half of it only! if you did please share it and thanks in advance
@@Ay_140 you have to free the result of ft_split if used (it should be used only if you have one argument)
if your variable is **splited_str, then you free(splited_str[0]) and then free(splited_str[1]) until splited_str[i] is NULL, and then you free(splited_str)
@@RiDOU-p2g i have done this but im still getting one block of memory not freed, searched everywhere but couldn’t fix it 😓
When i fix it it affects the behavior of the full function.
If you did it right share your git hub solution if you don’t mind 🙏🏻
@@Ay_140 I'm sorry you had to do this as my code has flaws! Someone else opened an issue in my GitHub regarding this, I'm wondering if that will shed any helpful light as well. Please do let me know how you go to solve it 🙏🏼
Also thanks @user-vh6rl1se8e for highlighting the leak and solution 😊
can you explain get next line pls?
Hello 😊 I won't be able to anytime soon, but I found this video super helpful m.ruclips.net/video/-Mt2FdJjVno/видео.html or check out my guide on the GitHub link that scored me 125%
@@thuggonautthanks!
Can you create video for projet minishell
Hello! I'm not up to minishell yet, but will definitely consider it once I am.
❤ from 1337 students
Right back at you 🥰
@@thuggonaut which campus you're studying on it
@@adamekhobba2156 I'm at 42 Adelaide. What about you?
@@thuggonaut 1337 if you know it. it's 42 school in Morocco
hai whos from 1337 lol
Feen cv kh or bg or med hhhh
I tested your code and it has a memory leak when you do a test that you expect the output to be "Error", example: "./push_swap "2 5 1 4 3 32 -42 ab"", I'm trying to solve it but I wasn't able to do so, if someone knows how to, please help me
have you solved it?
@@Myxoceph Yes, I was able to solve it
@@yasuofedeer9851 how? Can you help me too?
Hello! Thank you for visiting, and for this feedback, my program is definitely flawed! I'm glad you solved the issue, please share how so if you've the time 😊
@@Myxoceph you should free argv if it was dynamically allocated (what's returned from split)