Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
Non-Linear Data Structure 535
P
O
V W
(b)
Fig. 15.7{a) Tree representation (b) Linked representation
The structure for a tree node would be as follows.
struct node
{
int num;
struct node *ls;
struct node *rs
>
The pointers *ls and *rs point to the structure node. The pointer *ls contains the address of the left son
and rs is the pointer to the right son. If there are no left son and right son, then the pointers would be
NULL.
15.5 TRAVERSING BINARY TREES
As discussed earlier, three parameters are needed for formation of a binary tree. Passing through every
node of the tree is called traversing. Therefore, traversing of a tree means traversing of a
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343