Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Inorder traversal

446 views

Published on

inorder tree traversal

Published in: Education
  • Be the first to comment

  • Be the first to like this

Inorder traversal

  1. 1. TREE TRAVERSAL TREE TRAVERSAL is the process of visiting each node in the tree exactly once.  It has three methods :  inorder traversal  preorder traversal  postorder traversal 
  2. 2. ALGORITHM Traverse the left subtree of root.  Visit the root.  Traverse the right subtree of the root 
  3. 3. CODE Inorder(ptr) { struct node*ptr; { if(ptr!=NULL) { inorder(ptr->left); printf(“%c”,ptr->info); inorder(ptr->right); } } }
  4. 4. Procedure InOrderPrint(pointer) pointer NOT NULL? InOrderPrint(left child) L print(data) P InOrderPrint(right child) R root A C B D E G H AnswerDBFEAGCJHL F J L
  5. 5.   By the method of traversal we can also find infix , postfix, prefix notation. Infix notation can be obtained by inorder traversal

×