|
|
|
|
|
|
Ready-To-Run Visual Basic Algorithms: Updates |
|
|
|
|
|
|
|
|
- October 7, 2000, Pauk Squires
-
In the B+tree code in Chapter 7, the call
to WriteHeader in the DeleteItem routine should come after the End If statement.
The call to DeleteItemFromNode might merge two nodes and call routine TooSmall.
In that case, the program must call WriteHeader to update the garbage pointers.
- July 28, 1999, Mike Mitchell
-
There is a typo on page 24, "Print the items in the list." This code:
If Not IsNull(I) ...
is only testing the loop counter. It should read:
If Not IsNull(List(I))...
- August 30, 1998
-
The garbage collection example in Chapter 2 does not update m_GarbageCount when it
reclaims garbage items, so it thinks it contains a lot of garbage cells even after you reclaim them.
The solution is to reset m_GarbageCount to zero after performing garbage collection.
Here's a repaired version of subroutine.
' ************************************************
' Collect the garbage.
' ************************************************
Private Sub CollectGarbage()
Dim i As Long
Dim good As Long
' Comment out for real applications.
MsgBox "Collecting garbage."
good = 1 ' The first good item goes here.
For i = 1 To m_NumItems
' If it's not garbage,
' move it to its new location.
If Not IsNull(m_List(i)) Then
m_List(good) = m_List(i)
good = good + 1
End If
Next i
' This is where the last good item is.
m_NumItems = good - 1
' Added by Rod, 8/30/98.
' There is no garbage now.
m_GarbageCount = 0
' See if we should resize the list.
If m_NumItems < m_ShrinkWhen Then ResizeList
End Sub
|
- May 27, 1998
-
Chapter 7, program AVL, module AVL.BAS, subroutine ReplaceRightmost.
A bug makes the program remove nodes incorrectly. Here's a repaired version of subroutine
ReplaceRightmost that you can cut and paste into your program.
' Replace the target node with the rightmost node
' to the left of it.
Private Sub ReplaceRightmost(repl As AVLNode, _
shrunk As Boolean, target As AVLNode)
Dim child As AVLNode
If repl.RightChild Is Nothing Then
target.Box.Caption = repl.Box.Caption
' 5/27/98 The following line was commented out
' by Rod Stephens to fix a bug.
' Set target = repl
Set repl = repl.LeftChild
shrunk = True
Else
Set child = repl.RightChild
ReplaceRightmost child, shrunk, target
Set repl.RightChild = child
If shrunk Then RebalanceRightShrunk repl, shrunk
End If
End Sub |
- May 9, 1997
-
Many of the example programs use the TimeNow function to measure speed. This function
does not work in 32-bit enviroments. This update contains a new version of TIMENOW.BAS.
Replace the version you currently have in your Misc subdirectory with this file.
timenow.bas
|
|
|
|
|
Ready-To-Run Visual Basic Algorithms: Updates |
|
|
|
|
|
|
|
|
|