CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Binary Tree

  1. #1
    Join Date
    Feb 2000
    Posts
    18

    Binary Tree

    I have a binary tree which contains individuals with various ID numbers. I need to search the tree for a specific ID# and return if found. Any help would be appricated. Not sure where to start

    Thks,
    Brandon


  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Binary Tree

    Assuming its a sorted binary tree (which is the point of same) then you start at the root node. If the id of this is greater than the one you need check the left node else check the right node. Iterate while not found and left/right node exists.



    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

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

Featured