Skip to content

Fixed Errors. Code was not working #11503

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

Closed
wants to merge 4 commits into from

Conversation

snp05016
Copy link

@snp05016 snp05016 commented Jul 31, 2024

Describe your change:

I have changed the binary_tree_mirror.py
Function Naming: I changed the function names to be more descriptive. For example, I renamed binary_tree_mirror_dict to mirror_subtree and binary_tree_mirror to mirror_binary_tree. This makes it easier to understand what each function is supposed to do just by looking at the name.

Type Hints: I added type hints to the functions. This helps with readability and can also assist in debugging because it makes the expected types of inputs and outputs clear.

Simplified Logic: I simplified the variable names for the child nodes to left and right. I also added checks to ensure these nodes exist before making recursive calls. This makes the code more straightforward and easier to follow.

Error Messages: I enhanced the error messages to make them clearer. This way, if something goes wrong, the messages provide more useful information about what exactly the problem is.

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Jul 31, 2024
@cclauss
Copy link
Member

cclauss commented Aug 4, 2024

This merely looks like changing function names and variable names. Removing the docstring does not help. No type hints were changed. There is a stipulation that the code does not work yet none of the tests change.

@cclauss cclauss closed this Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants