bbk_doll
asked on
Linear and Non-Linear Data Structure
some of the data structures like array, linked list, stack etc. are linear whereas others like tree, graph etc are non-linear.
but what is meant by linear and non-linear data structures ?
how do we distinguish ?
Thanks.
but what is meant by linear and non-linear data structures ?
how do we distinguish ?
Thanks.
It's actually very simple ... linear means that there's one path that you can follow that leads from begin to end of the data structure :
1) array : has n consecutive elements which are stored from 0 to n-1
2) stack : same storage, but different accessors
3) linked list : also n consecutive elements, but they are linked using pointers
non-linear means that they are not linear ... ie. there can be several paths that start from the first element (or more general : a certain element) and traverse the data structure :
1) tree : has one root, but several branches which end in leafs ... branches can also have new branches. To traverse a tree, you have to go back several times
2) graph : similar, but there can also be circular paths
1) array : has n consecutive elements which are stored from 0 to n-1
2) stack : same storage, but different accessors
3) linked list : also n consecutive elements, but they are linked using pointers
non-linear means that they are not linear ... ie. there can be several paths that start from the first element (or more general : a certain element) and traverse the data structure :
1) tree : has one root, but several branches which end in leafs ... branches can also have new branches. To traverse a tree, you have to go back several times
2) graph : similar, but there can also be circular paths
ASKER
thanks Infinity08 !!
but ..
in tree which is non-linear, there is only one path to reach at each node. so it does not satisfy the criterion given by you.
pls. look into this again.
but ..
in tree which is non-linear, there is only one path to reach at each node. so it does not satisfy the criterion given by you.
pls. look into this again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks again.