Skip to content

Assignment 2 - Implement Question Two: Path to Leaves#2

Open
VincentSchaik wants to merge 4 commits intomainfrom
assignment-2
Open

Assignment 2 - Implement Question Two: Path to Leaves#2
VincentSchaik wants to merge 4 commits intomainfrom
assignment-2

Conversation

@VincentSchaik
Copy link
Owner

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

  • Implementation of the bt_path function using recursion with a helper function
  • Manual construction of a binary tree using the TreeNode class
  • Example test cases to validate functionality

What did you learn from the changes you have made?

  • How to traverse a binary tree recursively from root to leaves
  • The role of base cases and backtracking in recursive tree traversal

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

  • Yes, I considered a version without a helper function using simple recursion and combining return values directly.

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

  • Understanding how to correctly backtrack the path after each recursive call
  • Avoiding confusion with negative logic like if not ...
  • I overcame this by rewriting the logic with clear positive conditions and walking through small examples manually.

How were these changes tested?

  • Manually tested on multiple input trees
  • Confirmed correctness with printed trace outputs during development

A reference to a related issue in your repository (if applicable)

N/A

Checklist

  • I can confirm that my changes are working as intended

Copy link

@tianyi21 tianyi21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vincent,

Thank you for submitting your ADS A2.

✅ You implemented an algorithm to find the closest duplicate in a given tree.
✨ You implemented a BFS-based algorithm to solve the question.
✨ You utilized the queue and set data structures in your implementation.
✅ Your program runs successfully without any errors.
✅ Your program produces the intended results.

⚠️ Please review your partner's A1 work here, and complete Part 2-4 for your A2.

Thanks,
Tianyi [LS]

@VincentSchaik
Copy link
Owner Author

ADS Assignment 2 re-submitted.

Copy link

@tianyi21 tianyi21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vincent,

Thank you for revising your A2 submission.

✅ You correctly explained your partner's implementation and analyzed its time and space complexities.
✅ You included a paragraph to explain your experience and thoughts to us.

🎉 All your ADS assessments have been completed. Thank you for your participation, and I wish you all the best for the future!

Thanks,
Tianyi [LS]

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