Link to home
Start Free TrialLog in
Avatar of bbk_doll
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.
Avatar of bbk_doll
bbk_doll

ASKER

and experts, i have sent this question in c language category since i could not find "data Struture" category.
thanks again.

Avatar of Infinity08
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
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.

ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial