Jump to content

User:Hiteshsaldi/sandbox

From Wikipedia, the free encyclopedia

Tree traversals:

[edit]
Linked List

Inorder traversalExample – prints the node values in ascending order

1. Traverse the left subtree with an inorder traversal
2. Process the value in the node (i.e., print the node value)
3. Traverse the right subtree with an inorder traversal

Preorder traversal

1. Process the value in the node
2. Traverse the left subtree with a preorder traversal
3. Traverse the right subtree with a preorder traversal

Postorder traversal

1. Traverse the left subtree with a postorder traversal
2. Traverse the right subtree with a postorder traversal
3. Process the value in the node

Category:Data-structured programming languages