Docsity

Data Structures And Algorithm explaination and Types, Lecture notes of Data Structures and Algorithms

Toggle sidebar
bg1
CLASSIFICATION OF DATA STRUCTURES
A data structure provides a structured set of variables that are
associated with each other in different ways. It forms a basis of
programming tool that represents the relationship between data
elements and helps programmers to process the data easily. Data
structure can be classified into two categories:
PRIMITIVE DATA STRUCTURE
NON-PRIMITIVE DATA STRUCTURE
PRIMITIVE DATA STRUCTURE
Primitive data structures consist of the numbers and the characters
which are built in programs. These can be manipulated or operated
directly by the machine level instructions. Basic data types such as
integer, real, character, and Boolean come under primitive data
structures. These data types are also known as simple data types
because they consist of characters that cannot be divided.
NON-PRIMITIVE DATA STRUCTURE
Non-primitive data structures are those that are derived from primitive
data structures. These data structures cannot be operated or
manipulated directly by the machine level instructions. They focus on
formation of a set of data elements that is either homogeneous (same
data type) or heterogeneous (different data type). These are further
divided into linear and non-linear data structure based on the structure
and arrangement of data.
pf3
pf4
pf5

Partial preview of the text

Download Data Structures And Algorithm explaination and Types and more Lecture notes Data Structures and Algorithms in PDF only on Docsity!

CLASSIFICATION OF DATA STRUCTURES

A data structure provides a structured set of variables that are

associated with each other in different ways. It forms a basis of

programming tool that represents the relationship between data

elements and helps programmers to process the data easily. Data

structure can be classified into two categories:

 PRIMITIVE DATA STRUCTURE

 NON-PRIMITIVE DATA STRUCTURE

PRIMITIVE DATA STRUCTURE

Primitive data structures consist of the numbers and the characters

which are built in programs. These can be manipulated or operated

directly by the machine level instructions. Basic data types such as

integer, real, character, and Boolean come under primitive data

structures. These data types are also known as simple data types

because they consist of characters that cannot be divided.

NON-PRIMITIVE DATA STRUCTURE

Non-primitive data structures are those that are derived from primitive

data structures. These data structures cannot be operated or

manipulated directly by the machine level instructions. They focus on

formation of a set of data elements that is either homogeneous (same

data type) or heterogeneous (different data type). These are further

divided into linear and non-linear data structure based on the structure

and arrangement of data.

LINEAR DATA STRUCTURENON-LINEAR DATA STRUCTURE LINEAR DATA STRUCTURE

A data structure that maintains a linear relationship among its elements

is called a linear data structure. Here, the data is arranged in a linear

fashion. But in the memory, the arrangement may not be sequential.

Ex: Arrays, linked lists, stacks, queues.

NON-LINEAR DATA STRUCTURE

Non-linear data structure is a kind of data structure in which data

elements are not arranged in a sequential order. There is a hierarchical

relationship between individual data items. Here, the insertion and

deletion of data is not possible in a linear fashion. Trees and graphs are

examples of non-linear data structures.

I) ARRAY

Array, in general, refers to an orderly arrangement of data elements.

Array is a type of data structure that stores data elements in adjacent

locations. Array is considered as linear data structure that stores

elements of same data types. Hence, it is also called as a linear

homogenous data structure. When we declare an array, we can assign

initial values to each of its elements by enclosing the values in braces {}.

 Insertion and deletion of elements can be problematic because of

shifting of elements from their positions. However, these

limitations can be solved by using linked lists.

APPLICATIONS:

 Storing list of data elements belonging to same data type

 Auxiliary storage for other data structures

 Storage of binary tree elements of fixed count

 Storage of matrices

II) LINKED LIST

A linked list is a data structure in which each data element contains a

pointer or link to the next element in the list. Through linked list,

insertion and deletion of the data element is possible at all places of a

linear list. Also in linked list, it is not necessary to have the data

elements stored in consecutive locations. It allocates space for each

data item in its own block of memory. Thus, a linked list is considered

as a chain of data elements or records called nodes. Each node in the

list contains information field and a pointer field. The information field

contains the actual data and the pointer field contains address of the

subsequent nodes in the list.

APPLICATIONS:  Implementing stacks, queues, binary trees and graphs of predefined size  Implement dynamic memory management functions of operating system.  Polynomial implementation for mathematical operations

 Circular linked list is used to implement OS or application functions that require round robin execution of tasks.  Circular linked list is used in a slide show where a user wants to go back to the first slide after last slide is displayed.  Doubly linked list is used in the implementation of forward and backward buttons in a browser to move backwards and forward in the opened pages of a website.  Circular queue is used to maintain the playing sequence of multiple players in a game. III) STACKS A stack is a linear data structure in which insertion and deletion of elements are done at only one end, which is known as the top of the stack. Stack is called a last-in, first-out (LIFO) structure because the last element which is added to the stack is the first element which is deleted from the stack. A Stack In the computer’s memory, stacks can be implemented using arrays or linked lists. APPLICATIONS:  Temporary storage structure for recursive operations  Auxiliary storage structure for nested operations, function calls, Deferred/postponed functions  Manage function calls  Evaluation of arithmetic expressions in various programming languages  Conversion of infix expressions into postfix expressions Checking syntax of expressions in a programming environment Matching of parenthesis String reversal In all the problems solutions based on backtracking. Used in depth first search in graph and tree traversal. Operating System functions UNDO and REDO functions in an edit IV) QUEUES

A graph is also a non-linear data structure. In a tree data structure, all data elements are stored in definite hierarchical structure. In other words, each node has only one parent node. While in graphs, each data element is called a vertex and is connected to many other vertexes through connections called edge APPLICATIONS:  Representing networks and routes in communication, transportation and travel applications  Routes in GPS  Interconnections in social networks and other network-based applications  Mapping applications  Ecommerce applications to present user preferences  Utility networks to identify the problems posed to municipal or local corporations  Resource utilization and availability in an organization  Document link map of a website to display connectivity between pages through hyperlinks  Robotic motion and neural network