Great animation however I feel the point would be made more clear if the logical steps were listed in real time eg: node 17 > 18 = false -> backJump() or whatever its called (hypothetical example). Always hate how most descriptions of these make them more complicated than they need to be so I'm a fan of condensed animations with minimal description that cuts out all the crap. :)
Well, if you're programming in an object oriented paradigm you'll have a 'tree property' or a 'tree constraint / rule' and youll define leaf / node classes. These objects will be instantiated / created by a wider 'tree' class. When you invoke the insert() method, you want to give it a node and if the node is >, you want to traverse down that branch of the tree until you find a node that isn't. That's where you would insert it and then the tree would enforce the tree constraint (/rule). Remember that in this example we have trees of trees. Each branch with 2 children is a tree in itself, so all of these will do this check so that the root node doesn't need to do a crap tonne of checking as the tree grows. I'd recommend looking up anything titled along the lines of "Algorithms And Data Structures In Java" for some pseudocode and a description. Wiki also does a good job of it too (most of the time). Good luck!
Thanks for the visualization!
Great animation however I feel the point would be made more clear if the logical steps were listed in real time eg: node 17 > 18 = false -> backJump() or whatever its called (hypothetical example).
Always hate how most descriptions of these make them more complicated than they need to be so I'm a fan of condensed animations with minimal description that cuts out all the crap. :)
what tool used to build this animation?
thanks for this :)
Nice work!
what's the steps to build these?
Well, if you're programming in an object oriented paradigm you'll have a 'tree property' or a 'tree constraint / rule' and youll define leaf / node classes. These objects will be instantiated / created by a wider 'tree' class. When you invoke the insert() method, you want to give it a node and if the node is >, you want to traverse down that branch of the tree until you find a node that isn't. That's where you would insert it and then the tree would enforce the tree constraint (/rule). Remember that in this example we have trees of trees. Each branch with 2 children is a tree in itself, so all of these will do this check so that the root node doesn't need to do a crap tonne of checking as the tree grows.
I'd recommend looking up anything titled along the lines of "Algorithms And Data Structures In Java" for some pseudocode and a description. Wiki also does a good job of it too (most of the time).
Good luck!