Which of the following ways is a pre-order traversal?

Options
- Root->left sub tree-> right sub tree
- Root->right sub tree-> left sub tree
- right sub tree-> left sub tree->Root
- left sub tree-> right sub tree->Root


CORRECT ANSWER : Root->left sub tree-> right sub tree

Discussion Board
Pre-order traversal

Root->left sub tree-> right sub tree

Sujata junare 07-28-2020 10:07 AM

Data Structure - Preorder Traversal

Preorder traversal is used to create a copy of the tree. Algorithm for preorder traversal is:
Step 1: Start from the Root.
Step 2: Then, go to the Left Subtree.
Step 3: Then, go to the Right Subtree.

So, the above answer is correct. Preorder Traversal: Root -> Left subtree -> Right subtree

Prajakta Pandit 01-31-2017 06:05 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement