Results 1 to 1 of 1

Thread: Help me with my AVL Tree program implementation please

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    1

    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

    End Sub



    PLEASE HELP!!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width