Akhilesh Singh
Akhilesh Singh

Reputation: 23

Why Stack, Queue and LinkedList considered as Linear Data Structure?

I read few books, but still didn't understand why its considered as linear. Not sure because of appearance or sequential access or something else. If possible please explain in some logical terms.

Upvotes: 0

Views: 4925

Answers (6)

Rajesh
Rajesh

Reputation: 1

Linear data structures:

the elements (objects) are sequential and ordered in a way so that:

there is only one first element and has only one next element,

there is only one last element and has only one previous element, while

all other elements have a next and a previous element

https://codeandwork.github.io/courses/java/linearDataStructures.html

non-linear data structures are those that are not linear!

Upvotes: 0

Vidya Mane
Vidya Mane

Reputation: 1

Linked list :- Linked list is a collection of nodes . It has a end to end connection.one node is hold the address of another node or next node i.e. nodes are dependent on each other. They are connected in a linear manner.hence linked list is called as a linear data structure

Upvotes: 0

Alireza Zamani
Alireza Zamani

Reputation: 79

Data structures fall into two categories: Linear and Non-Linear. A data structure is said to be linear if the elements form a sequence, for example Array, Linked list, queue etc. Elements in a nonlinear data structure do not form a sequence, for example Tree, Hash tree, Binary tree, etc.

There are two ways of representing linear data structures in memory. One way is to have the linear relationship between the elements by means of sequential memory locations. Such linear structures are called arrays. The other way is to have the linear relationship between the elements represented by means of links. Such linear data structures are called linked list.

Upvotes: 4

Divyanshu Jimmy
Divyanshu Jimmy

Reputation: 2752

Just imagine nature .

When the events occur one after the other - you go for linear (time events , age , weather etc ) .

When the events branch out - you go for non linear (for example food-chain , biological nomenclature , classification of living beings into kingdoms , family etc )

Upvotes: 0

Naveen Yadav
Naveen Yadav

Reputation: 233

Linked lists, Stack, Queues are linear because they have connected in a manner that they can have only one descendant at any node. Unlike trees and graphs which can have one or more child or nodes connected to a given node.

Upvotes: 0

Jaskaran Singh
Jaskaran Singh

Reputation: 85

That is so because they follow a linear - fashion, they move from one block to another step - by - step.

Upvotes: 0

Related Questions