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

1.1 Introduction to Data Structures Linear and Non Linear Data (1)

The document provides an introduction to data structures, defining them as methods for organizing data to improve efficiency. It classifies data structures into primitive (like integers and characters) and non-primitive (derived from primitive structures), with further subdivisions into linear (e.g., arrays, stacks, queues) and non-linear structures (e.g., trees, graphs). The focus is on the characteristics and applications of these data structures in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

1.1 Introduction to Data Structures Linear and Non Linear Data (1)

The document provides an introduction to data structures, defining them as methods for organizing data to improve efficiency. It classifies data structures into primitive (like integers and characters) and non-primitive (derived from primitive structures), with further subdivisions into linear (e.g., arrays, stacks, queues) and non-linear structures (e.g., trees, graphs). The focus is on the characteristics and applications of these data structures in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Data Structures

What is Data Structure?

A data structure is a particular way of organising data in a computer so that it can be used
effectively. The idea is to reduce the space and time complexities of different tasks.

We can classify Data Structures into two categories:

1. Primitive Data Structure


2. Non-Primitive Data Structure

The following figure shows the different classifications of Data Structures.

Primitive Data Structures


1. Primitive Data Structures are the data structures consisting of the numbers and the characters
that come in-built into programs.
2. These data structures can be manipulated or operated directly by machine-level instructions.
3. Basic data types like Integer, Float, Character, and Boolean come under the Primitive Data
Structures.
4. These data types are also called Simple data types, as they contain characters that can't be
divided further

Department of Information Technology | APSIT


Non-Primitive Data Structures
1. Non-Primitive Data Structures are those data structures derived from Primitive Data
Structures.
2. These data structures can't be manipulated or operated directly by machine-level instructions.
3. The focus of these data structures is on forming a set of data elements that is
either homogeneous (same data type) or heterogeneous (different data types).
4. Based on the structure and arrangement of data, we can divide these data structures into two
sub-categories -
a. Linear Data Structures
b. Non-Linear Data Structures

a. Linear Data Structures


A data structure that preserves a linear connection among its data elements is known as a Linear Data
Structure. The arrangement of the data is done linearly, where each element consists of the successors
and predecessors except the first and the last data element. However, it is not necessarily true in the
case of memory, as the arrangement may not be sequential.

Based on memory allocation, the Linear Data Structures are further classified into two types:

1. Static Data Structures: The data structures having a fixed size are known as Static Data
Structures. The memory for these data structures is allocated at the compiler time, and their size
cannot be changed by the user after being compiled; however, the data stored in them can be
altered.
The Array is the best example of the Static Data Structure as they have a fixed size, and its
data can be modified later.
2. Dynamic Data Structures: The data structures having a dynamic size are known as Dynamic
Data Structures. The memory of these data structures is allocated at the run time, and their size
varies during the run time of the code. Moreover, the user can change the size as well as the
data elements stored in these data structures at the run time of the code. Linked
Lists, Stacks, and Queues are common examples of dynamic data structures.

Department of Information Technology | APSIT


Types of Linear Data Structures
In linear data structure the elements are stored in sequential order. Hence they are in the form
of a list, which shows the relationship of adjacency between elements and is said to be linear
data structure. The most, simplest linear data structure is a 1-D array, but because of its
deficiency, list is frequently used for different kinds of data. The linear data structures are:
(i) Array: The Array is a collection of data of same data type stored in consecutive memory
location and is referred by common name.

(ii) Stack: A stack is a Last-In-First-Out or First-In-Last-Out linear data structure in which


insertion and deletion takes place at only from one end called the top of the stack.

Department of Information Technology | APSIT


(iii) Queue: A Queue is a First-In-First-Out or Last-In-Last-Out data structure in which
insertion takes place from one end called the rear and the deletions takes place at one end called
the Front.

(iv) Linked List: Linked list is a collection of data of same type but the data items need not be
stored in consecutive memory locations. It is linear but non-contiguous type data structure. A
linked list may be a single list or double list.
• Single Linked list: - A single list is used to traverse among the nodes in one direction.
• Double linked list: - A double linked list is used to traverse among the nodes in both the
directions.

b. Non-linear data structure:-


In non linear data structure the elements are stored based on the hierarchical relationship among
the data. A list, which doesn’t show the relationship of adjacency between elements, is said to be
non-linear data structure.
The nonlinear data structures are:
(i) Tree: This data structure is used to represent data that has some hierarchical relationship
among the data elements. Thus, it maintains hierarchical relationship between various
elements.

Department of Information Technology | APSIT


(ii) Graph: This data structure is used to represent data that has relationship between pair of
elements not necessarily hierarchical in nature. It maintains random relationship or point-
to-point relationship between various elements. For example electrical and communication
networks, airline routes, flow chart and graphs for planning projects.

Department of Information Technology | APSIT

You might also like