Conversation
I am new to data structures so correct me if I'm wrong! I think you have some unnecessary code in your _left_rotation and _right_rotation methods. After setting pivot.left = pivot.right, the parent is already guaranteed to be the pivot, so you don't need to update it with the if block. Right? Also, the last line of code in each method doesn't need to update the parent of the pivot because the parent does not change … I think. Unless it is for some special case maybe? I am still learning so take my suggestions with a grain of salt. Thanks!
|
Oh my. I haven't touched this code in a while. 😄 Good eye! You are correct that the logic you have identified is unnecessary, and your changes check out. Nice work. 👍 Do you mind updating your commit message with a more concise note indicating the reason for the change? I will be happy to merge that in. Thank you for your contribution and good luck with your studies! |
|
I do apologize. I am very new to git, GitHub, and programming and obviously have no idea what I am doing so I just created a new pull request! |
|
Oh, there is absolutely no need to apologize! You've come across this repo, forked it to your own account, read through the code and found an opportunity to refactor, and submitted a pull request to improve the codebase for others. That's awesome in my book! As for the commit message format, well, that's a bit on me as well since I have not provided a Contributing guide for this repository. This was a small project I put together during my own studies a few years ago, and I had not anticipated outside contributors joining in. Thanks again for that. Also, full disclosure, many of the early commits on this project were not written with the most meaningful messages either! But, then, we improve as we go along. To revise your commit message, consider following a few best practices like having a short, meaningful subject line separate from the body of your commit message. This greatly helps to see at a glance why a particular commit was made when viewing the commit history when using a command like There are several sources for advice on this subject. Here is one that popped up on my search today. I see that you have submitted a second PR (#55) with an alternate commit message. That is one approach to take--closing a previous PR and submitting a new one after review. However, it is worth noting that you can also modify the existing PR by making changes to your source branch locally and pushing the changes again. This can be done by either adding new commits or modifying existing ones with some like If you do opt to go the route of changing git history ( So, to bring your changes into this project, please do one of the following:
Thanks again for your contribution! |
|
In case you get this by email, note that I originally included the wrong link for commit message guidelines. Sorry about that. It has been fixed in original comment and linked here. |
|
Thanks a lot for the links, they're very helpful! Honestly (embarrassingly), |
|
Closed in favor of #57 |
I am new to data structures so correct me if I'm wrong! I think you have some unnecessary code in your _left_rotation and _right_rotation methods. After setting pivot.left = pivot.right, the parent is already guaranteed to be the pivot, so you don't need to update it with the if block. Right? Also, the last line of code in each method doesn't need to update the parent of the pivot because the parent does not change … I think. Unless it is for some special case maybe? I am still learning so take my suggestions with a grain of salt. Thanks!