Help me with my AVL Tree program implementation please
I just started learning VB.net and having a hard time fixing this error. Can anyone please help me with this AVL Tree Implementation program?
I am also attaching all the files to run this program. The 'Inorder Traversal' works fine; however, when I implemented 'BreadthFirstSearch Traversal,' I am getting this error message.
I am getting an error message on clsAVLTree file with errors like:
InvalidCastException was unhandled.
Unable to cast object of type 'System.Int32' to type 'prjAVLTree.clsNode'
Public Sub recursiveSearch(ByVal theRoot As clsNode, ByVal queue As clsQueue)
theRoot.DisplayNode()
queue.removeQueue()
'Insert Left node
If Not (theRoot.Left Is Nothing) Then
queue.AddTail(23, theRoot.Left)
End If
'Insert Right node
If Not (theRoot.Right Is Nothing) Then
queue.AddTail(60, theRoot.Right)
End If
If Not (queue.Head.Right Is Nothing) Then
Dim udtTemp As New clsNode
udtTemp = CType(queue.Head.Right.Data, clsNode)
recursiveSearch(CType(udtTemp, clsNode), queue)
End If