Inorder traversal
Upcoming SlideShare
Loading in...5
×
 

Inorder traversal

on

  • 178 views

inorder tree traversal

inorder tree traversal

Statistics

Views

Total Views
178
Views on SlideShare
178
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Inorder traversal Inorder traversal Presentation Transcript

  • 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 
  • ALGORITHM Traverse the left subtree of root.  Visit the root.  Traverse the right subtree of the root 
  • CODE Inorder(ptr) { struct node*ptr; { if(ptr!=NULL) { inorder(ptr->left); printf(“%c”,ptr->info); inorder(ptr->right); } } }
  • 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
  •   By the method of traversal we can also find infix , postfix, prefix notation. Infix notation can be obtained by inorder traversal