-
Notifications
You must be signed in to change notification settings - Fork 19.9k
Serialize and Deserialize the Binary Tree added #5691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5691 +/- ##
============================================
- Coverage 65.97% 65.97% -0.01%
- Complexity 4387 4388 +1
============================================
Files 602 602
Lines 16783 16783
Branches 3226 3226
============================================
- Hits 11073 11072 -1
- Misses 5265 5266 +1
Partials 445 445 ☔ View full report in Codecov by Sentry. |
@alxkm Finally added the algorithm . |
@alxkm any changes need to be done ? |
return root; | ||
} | ||
|
||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace main with JUnit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure will update and push it
thank you
@@ -0,0 +1,137 @@ | |||
import java.util.LinkedList; // Replace with specific imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this comment?
import java.util.LinkedList; // Replace with specific imports | ||
import java.util.Queue; | ||
|
||
// Define the TreeNode class to represent nodes in the binary tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description would be better to have as javadoc
|
||
// Define the TreeNode class to represent nodes in the binary tree. | ||
class TreeNode { | ||
int val; // Value stored in the node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments below for TreeNode are very obvious. The code loses clarity with them.
|
||
public class SerializeaBinaryTree { | ||
|
||
// The 'serialize' method converts a binary tree into a string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please clean up your code from some obvious things like variable definitions and describe some important things in Javadocs.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution! |
Please reopen this pull request once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution! |
clang-format -i --style=file path/to/your/file.java