DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    2

    Exclamation Tree Traversal Questions

    According to the tree at http://www.geocities.com/beamer7296/images/tree.JPG, can someone please check my traversals below to see if thry're all correct!?! I'd really appreciate it!

    Level-order traversal - A, B, D, E, F, H, J, K, M, Q, R, S, T, U, C, W, X, Y
    Preorder traversal - A, B, E, K, X, T, Y, U, M, F, D, H, Q, C, W, J, R, S
    Postorder traversal - K, X, T, Y, U, M, E, F, B, C, W, Q, H, R, S, J, D, A
    Inorder traversal - K, E, M, T, X, U, Y, B, F, A, D, H, Q, C, W, J, R, S

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    I think that the orders would go as follows:

    preorder - you "print" when you first hit the node
    A, B, E, K, M, T, X, U, Y, F, D, H, Q, C, W, J, R, S

    inorder - you "print" after the traversal returns from a visit down the sub-tree rooted by your left child, before you traverse down the subtree rooted by your right child
    K, E, T, X, M, Y, U, F, C, Q, W, H, D, R, J, S

    postorder - you "print" after return from both children
    K, X, T, Y, U, M, E, F, B, C, W, Q, H, R, S, J, D, A

Similar Threads

  1. Replies: 0
    Last Post: 02-21-2006, 08:47 PM
  2. Changing targets in XML Tree
    By jdnyc in forum XML
    Replies: 0
    Last Post: 11-07-2005, 02:48 AM
  3. Dynamic tree view control
    By anbaz in forum ASP.NET
    Replies: 2
    Last Post: 06-15-2005, 09:09 PM
  4. Tree View Control Questions
    By John G. in forum .NET
    Replies: 3
    Last Post: 03-04-2002, 07:27 AM
  5. Replies: 2
    Last Post: 01-15-2001, 11:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links