Linear vs Non Linear Data Structure

Hello experts,
please tell me
1. what is difference between Linear and Non Linear Data Structures ?
Linear are - Array, Linked List, Stack, Queue
Non Linear are - Tree, Graph
2. In which category does Heap Come ?
soodsandeepAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Infinity08Commented:
>> 1. what is difference between Linear and Non Linear Data Structures ?

Linear means that they are represented by one (single) series of data ... ie. Each data member has at most one predecessor and at most one successor.

Non-linear means anything else.


>> 2. In which category does Heap Come ?

non-linear, since it's a kind of tree :

        http://en.wikipedia.org/wiki/Heap_(data_structure)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
deepu chandranCommented:
Hi,
>>Linear are - Array, Linked List, Stack, Queue

In the above category Linked List will not come as Liniear, also Stack and Queue we can implement as NonLinear. Array is the perfect example of Linear


0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Infinity08Commented:
>> In the above category Linked List will not come as Liniear, also Stack and Queue we can implement as NonLinear.

No, not true. See my explanation. And if you don't believe me, see the links evilrix posted.
0
deepu chandranCommented:
Sorry, i confused with Sequential and NonSequential Data Structures.

0
meoconxCommented:
Linear or non-linear depend on how you search an element with a specified key.
In linear structure, when you find an key, you have to begin at the first element in the structure and go down to when you meet the key you want to find.
And non-linear is of course not linear  :) => when you do a search in a non-linear structure is generally faster than linear structure .
in Heap, we needn't care whether it's linear or not, because the main purpose of heap is make us easily to obtain max or min key of the data structure.
0
Infinity08Commented:
>> Linear or non-linear depend on how you search an element with a specified key.

That's not what defines linear versus non-linear (see my post for that ;) ). If a linear data structure, like an array for example, is sorted, you can often search as fast as with say a binary tree.

Or, look at it from a different perspective : linked lists and arrays are two linear data structures, yet the way search algorithms are implemented with them are quite different. Queues and stacks are other examples of linear data structures, but there's usually no need for searching in them, so again : search strategies are not a defining characteristic of linear versus non-linear data structures.
0
roussoscCommented:
I am not sure that your question is well-defined enough to give an answer.
On the one hand if you would like a definition of linear vs. non-linear data structures one could certainly be manufactured.  Whether the definition would be useful for your purposes is another question.  

The referenced wikipedia page is basically trying to define the difference through examples.  On this page linear data structures are basically one dimensional and non-linear have more than one dimension.
This is consistent with what one finds In text books where typical examples of linear are lists and one-dimensional arrays and typical examples of non-linear are graphs (including trees) and arrays of 2 or more dimensions.  This is basically what the wikipedia page is saying but some unfortunate choice of terminology confuses the issue.  e.g., the page lists a matrix and a sparse matrix as being linear but from the context I think the author meant only to include one-dimensional matrices.  Including "Parallel Array" in the linear category may be debatable.

You can find consistent categorization of linear vs non-linear in many data strures books.
0
soodsandeepAuthor Commented:
Thanks Infinity08 !
i m ur fan. get many excellent answers from u.
thanks.
0
Infinity08Commented:
I'm glad to be of assistance :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Algorithms

From novice to tech pro — start learning today.