Talk:AVL tree: Difference between revisions

Content added Content deleted
m (restore discussions)
Line 2: Line 2:
The C++ code present on the main page does not define a non-generic base class for node. This means that the code regenerates the balancing routines for each data type supported by the generic. Also, the code descends the tree to calculate the node balance for each of the rotations (which is a real no-no). This would heavily impact balancing performance. The elaborate version is completely different and the methods to rotate don't update the balance factor (which incidentally is an enum). The Java version that is present on the main AVL Page (not the elaborate version) suffers from the same problem in that it also descends the tree during rotations to calculate the balance.[[User:NNcNannara|NNcNannara]] ([[User talk:NNcNannara|talk]]) 12:57, 13 July 2016 (UTC)
The C++ code present on the main page does not define a non-generic base class for node. This means that the code regenerates the balancing routines for each data type supported by the generic. Also, the code descends the tree to calculate the node balance for each of the rotations (which is a real no-no). This would heavily impact balancing performance. The elaborate version is completely different and the methods to rotate don't update the balance factor (which incidentally is an enum). The Java version that is present on the main AVL Page (not the elaborate version) suffers from the same problem in that it also descends the tree during rotations to calculate the balance.[[User:NNcNannara|NNcNannara]] ([[User talk:NNcNannara|talk]]) 12:57, 13 July 2016 (UTC)
: It's just example code, it's not production quality code. These codes are only intended to demonstrate the principle of an AVL tree. Secondary features such as input validation, error handling, cloning, generics etc, are often relaxed or omitted in RosettaCode entries, so as not to distract from primary features. [[User:Fwend|Fwend]] ([[User talk:Fwend|talk]]) 13:34, 13 July 2016 (UTC)
: It's just example code, it's not production quality code. These codes are only intended to demonstrate the principle of an AVL tree. Secondary features such as input validation, error handling, cloning, generics etc, are often relaxed or omitted in RosettaCode entries, so as not to distract from primary features. [[User:Fwend|Fwend]] ([[User talk:Fwend|talk]]) 13:34, 13 July 2016 (UTC)

==New C++ AVL==

I added the source code of AVL Trees in C++. This source code is more than 20 years old now - although it did get heavily modified in 2006, right after the C# code was created. I'll leave it to others to port this C++ code to other languages like D.[[User:NNcNannara|NNcNannara]] ([[User talk:NNcNannara|talk]]) 11:45, 10 July 2016 (UTC)

I added a Managed C++ version in place of the existing code. I expect it will be moved to its own page as it is rather lengthy. [[User:NNcNannara|NNcNannara]] ([[User talk:NNcNannara|talk]]) 10:37, 13 July 2016 (UTC)

: I think the commentary from the discussion page is best placed on the task page itself, otherwise not many people are going to see it. [[User:Fwend|Fwend]] ([[User talk:Fwend|talk]]) 11:12, 13 July 2016 (UTC)

==Java AVL==

I added the source code of AVL Trees in Java.[[User:NNcNannara|NNcNannara]] ([[User talk:NNcNannara|talk]]) 13:13, 9 July 2016 (UTC)
: Your code is rather long, I've moved it to a separate page. [[User:Fwend|Fwend]] ([[User talk:Fwend|talk]]) 14:59, 9 July 2016 (UTC)
:: Thanks [[User:NNcNannara|NNcNannara]] ([[User talk:NNcNannara|talk]]) 11:42, 10 July 2016 (UTC)


==Here nor there==
==Here nor there==