0% found this document useful (0 votes)
5 views

Linear and Non Linear

The document explains the distinction between linear and non-linear data structures, highlighting their arrangement, levels, implementation complexity, traversal ease, memory utilization, and time complexity. Linear data structures, such as arrays and lists, have sequential connections and are easier to implement, while non-linear structures, like trees and graphs, allow for hierarchical connections but are more complex. Additionally, it differentiates between primitive data structures, which store a single data type, and non-primitive structures, which can store multiple types in one entity.

Uploaded by

Nikita Nair
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Linear and Non Linear

The document explains the distinction between linear and non-linear data structures, highlighting their arrangement, levels, implementation complexity, traversal ease, memory utilization, and time complexity. Linear data structures, such as arrays and lists, have sequential connections and are easier to implement, while non-linear structures, like trees and graphs, allow for hierarchical connections but are more complex. Additionally, it differentiates between primitive data structures, which store a single data type, and non-primitive structures, which can store multiple types in one entity.

Uploaded by

Nikita Nair
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

萸՛葸՛茨 ՛ ՛ 茨 茨葸

A Linear data structure have data elements arranged in sequential


manner and each member element is connected to its previous and next
element. This connection helps to traverse a linear data structure in a
single level and in single run. Such data structures are easy to implement
as computer memory is also sequential. Examples of linear data
structures are List, Queue, Stack, Array etc.

댠՛饠䖇萸՛葸՛茨 ՛ ՛ 茨 茨葸
A non-linear data structure has no set sequence of connecting all its
elements and each element can have multiple paths to connect to other
elements. Such data structures supports multi-level storage and often
cannot be traversed in single run. Such data structures are not easy to
implement but are more efficient in utilizing computer memory.
Examples of non-linear data structures are Tree, BST, Graphs etc.

Following are the important differences between Linear Data Structures


and Non-linear Data Structures.

茨. K葸y 萸՛葸՛茨 ՛ ՛ 茨 茨葸 댠՛饠䖇萸՛葸՛茨 ՛ ՛


댠. 茨 茨葸

Data Element In linear data In non-linear data


Arrangement structure, data structure, data
elements are elements are
1 sequentially connected hierarchically
and each element is connected and are
traversable through a present at various
single run. levels.

Levels In linear data In non-linear data


2
structure, all data structure, data
茨. K葸y 萸՛葸՛茨 ՛ ՛ 茨 茨葸 댠՛饠䖇萸՛葸՛茨 ՛ ՛
댠. 茨 茨葸

elements are present elements are present


at a single level. at multiple levels.

Implementati Linear data structures Non-linear data


on complexity are easier to structures are difficult
implement. to understand and
3
implement as
compared to linear
data structures.

Traversal Linear data structures Non-linear data


can be traversed structures are not
completely in a single easy to traverse and
4
run. needs multiple runs to
be traversed
completely.

Memory Linear data structures Non-linear data


utilization are not very memory structures uses
5 friendly and are not memory very
utilizing memory efficiently.
efficiently.

Time Time complexity of Time complexity of


Complexity linear data structure non-linear data
6
often increases with structure often remain
increase in size. with increase in size.
茨. K葸y 萸՛葸՛茨 ՛ ՛ 茨 茨葸 댠՛饠䖇萸՛葸՛茨 ՛ ՛
댠. 茨 茨葸

Examples Array, List, Queue, Graph, Map, Tree.


7
Stack.

Primitive vs non-primitive data structure


Data structure means organizing the data in the memory. The data can be organized
in two ways either linear or non-linear way.

There are two types of data structure available for the programming purpose:

o Primitive data structure


o Non-primitive data structure

Primitive data structure is a fundamental type of data structure that stores the data
of only one type whereas the non-primitive data structure is a type of data structure
which is a user-defined that stores the data of different types in a single entity.

In the above image, we can observe the classification of the data structure. The data
structure is classified into two types, i.e., primitive and non-primitive data structure.
In the case of primitive data structure, it contains fundamental data types such as
integer, float, character, pointer, and these fundamental data types can hold a single
type of value. For example, integer variable can hold integer type of value, float
variable can hold floating type of value, character variable can hold character type of
value whereas the pointer variable can hold pointer type of value

You might also like