Skip to content
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

[Python] Challenge 4 #358

Merged
merged 3 commits into from
Jan 18, 2017
Merged

Conversation

sarcodian
Copy link
Contributor

No description provided.

@ManuelMeraz
Copy link
Contributor

@sarcodian Can you scale this up to any size binary tree? I think I would be able to accept this PR if I could see an tree inversion function for a binary tree of any size, not just the given example. The way you have your array should be fine, just make it so it scales up.

@sarcodian
Copy link
Contributor Author

Hey, added a method to make random trees.

@ManuelMeraz
Copy link
Contributor

@sarcodian Would your code work if we had a binary tree with 128 integers with a depth of lg128 = 7? What about with 256?

@sarcodian
Copy link
Contributor Author

@ManuelMeraz It should. the actual reverse implementation is the same logic as some/most of the other submissions, recurse down until you get a null. Although not from the CS field so I have no idea if you would run into resource issues with this. I am just stubbornly sticking to lists instead of making a class in data/left/right format.

@Remillardj
Copy link
Contributor

@sarcodian In a large scale, you would lose memory really really quick. But for now, I see this a slightly unique, albeit not the best, solution. With that said, Ill accept it.

@Remillardj Remillardj merged commit f2c3ffb into YearOfProgramming:master Jan 18, 2017
@Remillardj Remillardj changed the title [Python] Challenge 4 (Unreviewed) [Python] Challenge 4 Jan 18, 2017
@sarcodian sarcodian deleted the python_4 branch January 23, 2017 12:37
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.

3 participants