Tagged Questions
6
votes
1answer
174 views
How can this python quadtree be improved?
Here's an attempt I've made of implementing the Barnes-Hut nbody algorithm, or its initial stage - The quadtree. That there're lots of lengthy doc strings might excuse the lack of detailed explanation ...
6
votes
1answer
101 views
Functional, but not recursive, tree traversal
To learn tree traversal i implemented os.walk, tail-recursive and stack-based. Unfortunately Python doesn't support tail call optimization. How do i rewrite my ...
5
votes
1answer
95 views
3
votes
2answers
530 views
Returning a list of the values from the binary tree
I want to return a list of the values from the binary tree. Is there a shorter and more efficient way to write the method for numbers?
...
1
vote
2answers
178 views
Die-rolling for ordering
I have a little experience with Python and am trying to become more familiar with it. As an exercise, I've tried coding a program where the ordering of a list of players is determined by the roll of a ...
0
votes
2answers
75 views
How to enumerate the internal nodes and leaves of a tree more elegantly?
Might there be a simpler way to write this code? I'd like to learn to write code more efficiently.
...