lecture-14

Traverse to the le subtree of a the subtree is empty

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ULL NULL NULL H F NULL NULL NULL NULL 5. Visit the root A of the le< subtree of B CPSC 223  ­ ­ Fall 2010 14 7 10/19/10 Depth-First, Left-to-Right Tree Traversal previous subtree previous subtree previous subtree current subtree D B A G C E NULL NULL NULL NULL NULL H F NULL NULL NULL NULL 5. Traverse to the le/ subtree of A –  The subtree is empty, so nothing to visit –  We’re done going le< … Note this is what is meant by “depth first” CPSC 223  ­ ­ Fall 2010 15 Depth-First, Left-to-Right Tree Traversal previous subtree previous subtree previous subtree D B A G C E NULL NULL NULL NULL NULL current subtree H F NULL NULL NULL NULL 6. Traverse to the right subtree of A –  The subtree is empty, so nothing to visit –  We’re done going right … CPSC 223  ­ ­ Fall 2010 16 8 10/19/10 Depth-First, Left-to-Right Tree Traversal previous subtree previous subtree current subtree D B A G C E NULL NULL NULL NULL NULL H F NULL NULL NULL NULL 7. Finished with the subtree rooted at A –  We traversed both le< and right subtrees –  Now return to the previous subtree CP...
View Full Document

Ask a homework question - tutors are online