Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
  Ready-To-Run Delphi Algorithms: Updates  
 
Overview Table of Contents Updates
Wiley
 
 
 

July 15, 2000
Uwe Gissemann sent me this note:

I would like to suggest a correction for the AVL trees in chapter 7. The procedure "ReplaceRightMost" updates the pointer to "repl" in the node that is just going to be deleted. I checked your Web site and tried your update, but this update also has a glitch.

Your new approach is to pass "Parent.LeftChild" to "RebalanceRightShrunk". However, this is only correct when you are in the first recursion level in "ReplaceRightMost". It might also be "Parent.RightChild" that you must pass. Principally, we have to pass that child pointer of "Parent" that points to "repl".

So, my quick fix, based on your update, was to modify the code to this:

if (shrunk) then
    if Parent.LeftChild = repl then
        RebalanceRightShrunk(Parent.LeftChild, shrunk)
    else
        RebalanceRightShrunk(Parent.RightChild, shrunk);

This seems to work. I tested it with hundred thousends of records I added and removed.

September 16, 1999
The AVL program in Chapter 7 does not handle all rotations correctly. This file includes a revised program and a Readme.txt file containing some more details. da_update1.zip

 

 
  Ready-To-Run Delphi Algorithms: Updates  
 
Overview Table of Contents Updates
Wiley
 
 
 

Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated