Skip to content

Complete Trees-3 assignment - #1591

Open
tejbharath wants to merge 2 commits into
super30admin:masterfrom
tejbharath:master
Open

Complete Trees-3 assignment#1591
tejbharath wants to merge 2 commits into
super30admin:masterfrom
tejbharath:master

Conversation

@tejbharath

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Path Sum II (PathSumTwo.java)

E.g., backtracking step path.remove(path.size() - 1) is correct and properly placed.

E.g. backtracking step path.remove(path.size() - 1) is E.g. backtracking space complexity is O(h) where h is the height of the feedback is O(h) where h is the header is O(h) where h is the height of the tree.

E.g. backtracking step path.remove(path.size() - e.g. backtracking step path.remove(path.size() - 1)` is correct and properly placed.

E.g. backtracking step path.add(root.val); is correct and properly placed.

E student's solution is correct and efficient. student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and correct and efficient.

E student's solution is correct and efficient.

E student's solution helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return result but the caller doesn't use the return value. The caller doesn't use the return value. The helper function returns result but the caller doesn't use the return value. The minor issue: the helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't caller's doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The complexity is O(n) for traversal plus O(n) for path copies at leaves, giving O(n^2) in worst case.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and correct and efficient.

E student's minor issue: the helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value control flow issue: the helper function returns return result; at the end, but this is unreachable code in the recursive calls since the helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the result. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. Return value is ignored. The caller doesn't use the return value. Return value is ignored. The caller doesn't use the return value. Return value is ignored. The caller doesn't use the return value. Return value is ignored. The caller doesn't use the return value. solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

student's solution is correct and efficient.

student's solution is correct and efficient.

student's solution is correct flow issue: the helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. style issue: the helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. style issue: the helper function returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is handled by the base case. The caller doesn't recurse on null children, which is returns result but the caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The caller doesn't use the return value. The(n) for traversal plus O(n) for path copies at leaves, giving O(n^2) in worst case.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is check the leaf check is correct: root.left == null && root.right == null correctly identifies leaf nodes.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is recurse on null children, which is handled by the base case.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct the leaf check is correct: root.left == null && root.right == null correctly identifies leaf nodes.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution backtracking step path.remove(path.size() - 1) is correct and properly placed.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and efficient.

E student's solution is correct and check the leaf check is correct: root.left == null && root.right == null correctly identifies leaf nodes.

E student's solution is correct and efficient

VERDICT: NEEDS_IMPROVEMENT


Symmetric Tree (SymetricTree.java)

Great work on implementing the recursive approach! Your logic for checking mirror symmetry is correct. Here are some points to consider:

  1. Edge case handling: When root == null, the standard convention is to return true (an empty tree is symmetric). Your current implementation returns false. While the problem constraints state there's at least 1 node, it's good practice to handle this edge case correctly.

  2. Space complexity: Your comment states O(1) space complexity, but this is incorrect. The recursive approach uses O(h) space due to the recursion stack, where h is the height of the tree. In the worst case (skewed tree), this is O(n).

  3. Typo: The class name "SymetricTree" should be "SymmetricTree".

  4. Code structure: Consider adding the package declaration and proper imports for clarity.

  5. Strengths: Your recursive logic is clean and correct. The helper function properly handles all the base cases and recursive cases.

VERDICT: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants