DATA STRUCTURE ALGORITHMS
DATA STRUCTURE: - A data structure is a way of organizing and storing data in a computer so that it can be accessed and used
efficiently. It refers to the logical or mathematical representation of data, as well as the implementation in a computer pro gram.
ALGORITHMS: - An algorithm is a set of step-by-step instructions to solve a given problem or achieve a specific goal.
THERE ARE TWO TYPES OF DATA STRUCTURE.
1. Primitive data structure
2. Non-primitive data structure
1. Primitive data structure: - Primitive data types are the built-in data types provided by JavaScript. They represent single
values and are not mutable. JavaScript supports the following primitive
TYES OF PRIMITIVE DATA STRUCTURE
Int, float, char, Boo, pointer
2. Non-primitive data structure:- Non-primitive data types, also known as reference types, are objects and derived data types.
They can store collections of values or more complex entitie
THERE ARE TWO TYPES OF NON-PRIMITIVE DATA STRUCTURE
1. Linear data structure
2. Non – linear data structure
Difference Between Primitive vs Non-Primitive
Primitive Non-Primitive
1. Primitive Data types are predefined. 1. Non-Primitive data types are created by the
program.
2. Primitive Data types will have certain values
2. Non-Primitive data types can be NULL
3. Size depends on the type of data structure
3. Size is not fixed
4. Examples are numbers and strings
4. Examples are Array and Linked List .
5. It can start with a lowercase .
5. It can start with uppercase
1. Linear data structure:- Data structure where data elements are arranged sequentially or linearly where each and every
element is attached to its previous and next adjacent is called a linear data structure. In linear data structure, single
level is involved. Therefore, we can traverse all the elements in single run only. Linear data structures are easy to
implement because computer memory is arranged in a linear way.
Array , stack , queue , linked list
2. Non – linear data structure:- Data structures where data elements are not arranged sequentially or linearly are called non-
linear data structures. In a non-linear data structure, single level is not involved. Therefore, we can't traverse all the
elements in single run only. Non-linear data structures are not easy to implement in comparison to linear data structure. It
utilizes computer memory efficiently in comparison to a linear data structure
Trees , graph
Difference between Linear and Non-linear Data Structures
Linear Data Structures Non-linear Data Structures
1. In a linear data structure, data elements are 1. In a non-linear data structure, data elements
arranged in a linear order where each and are attached in hierarchically manner.
every element is attached to its previous and
next adjacent. 2. Whereas in non-linear data structure, multiple
levels are involved.
2. In linear data structure, single level is 3. While its implementation is complex in
involved. comparison to linear data structure
3. Its implementation is easy in comparison to 4. While in non-linear data structure, data
non-linear data structure elements can't be traversed in a single run
only
4. In linear data structure, data elements can be
traversed in a single run only 5. While in a non-linear data structure, memory
is utilized in an efficient way
5. In a linear data structure, memory is not
6. While its examples are: trees and graphs
utilized in an efficient way
6. Its examples are: array, stack, queue, linked 7. Applications of non-linear data structures are
list, etc. in Artificial Intelligence and image processing.
7. Applications of linear data structures are
mainly in application software development