Skip to content

Commit 48fa2cd

Browse files
committed
Serialize and Deserialize the Binary Tree added
1 parent a76f68e commit 48fa2cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/java/com/thealgorithms/datastructures/trees/SerializeaBinaryTree.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TreeNode {
1414
}
1515
}
1616

17-
public class BinaryTreeSerializer {
17+
public class SerializeaBinaryTree {
1818

1919
// The 'serialize' method converts a binary tree into a string.
2020
public String serialize(TreeNode root) {
@@ -116,8 +116,8 @@ public static void main(String[] args) {
116116
root.right.left = new TreeNode(4); // Create the left child of node 3 (value 4)
117117
root.right.right = new TreeNode(5); // Create the right child of node 3 (value 5)
118118

119-
// Instantiate the BinaryTreeSerializer class
120-
BinaryTreeSerializer serializer = new BinaryTreeSerializer();
119+
// Instantiate the SerializeaBinaryTree class
120+
SerializeaBinaryTree serializer = new SerializeaBinaryTree();
121121

122122
// Serialize the tree to a string format
123123
String serializedTree = serializer.serialize(root);

0 commit comments

Comments
 (0)