Data Structures Introduction
Data Structures Introduction
Data: Data is representation of facts or concepts in an organized manner. The data may
be stored, communicated, interpreted, or processed. In short, we can say that the data is
a piece of information or simply set of values and such data may not convey any meaning.
Data Information
Data is collection of facts and figures. Facts Information is the result of processing the
are the things done or things existing data. So, information is collection of data
from which we can draw conclusion
Data is the representation of information. Information is the thing that we know. So,
So, data representation may change even though data representation changes,
information do not change
Entity: An entity can be defined as a person, place, thing or concept about which data can
be collected and stored. An entity is made up of a number of attributes which represent
that entity. An attribute is the one which describes the facts, details or characteristics of
an entity.
IIIT-Naya Raipur.
Field: A field is a single elementary unit of information representing an attribute of an
entity. A record is collection of field values of a given entity. A file is a collection of records
of the entities in a given entity set.
Data Structures: The study of how efficiently the different types of data are collected and
stored in the memory, how efficiently the data is organized in the memory, how
efficiently the data can be retrieved and manipulated, and the possible ways in which
different data items are logically related is called data structures. In data structures, the
term data means values and the term structures means the way the values are structured
or organized or stored in memory.
Data Structures
Int
Float
Linear Data Non-linear
Char
Structures Data Structures
Double
Pointers Arrays Trees
Stacks Graphs
Queues Files
Linked Lists
Primitive Data Structures: The data structures that can be manipulated directly by
machine instructions are called primitive data structures. Thus, the primitive data
structures are fundamental data types that are supported by programming language. The
primitive data structures are also called simple data structures.
Ex: In C language, the different primitive data structures are defined using the data types
such as int, float, char, double and pointers.
Non-primitive Data Structures: The data structures that cannot be manipulated directly
by machine instructions are called non-primitive data structures. Thus, the non-primitive
data structures are created or constructed using primitive data structures. The non-
primitive data structures are also called compound data structures.
IIIT-Naya Raipur.
The non-primitive data structures are classified into two types: Linear data structures and
Non-linear data structures.
Linear Data Structures: The data structures where its’ values or elements are stored in a
sequential (linear) order is called linear data structures. The elements can be accessed
sequentially one after the other in a linear order and hence the name. The linear
relationship between the elements maintained: 1) by means of sequential memory
locations as in array, 2) by means of links as in linked lists (Logical adjacency).
Arrays: An array is a special and very powerful data structure in C language. An array is
a collection of similar data items. All elements of the array share a common name. Each
element in the array can be accessed by the subscript (or index). Array is used to store,
process and print large amount of data using a single variable.
Stacks: A stack is a special type of data structure (linear data structure) where elements
are inserted from one end and elements are deleted from the same end. Using this
approach, the Last Element Inserted is the First element to be deleted Out, and hence,
stack is also called Last In First Out (LIFO) data structure.
Queues: A queue is a special type of data structure (linear data structure) where elements
are inserted from one end and elements are deleted from the other end. The end at which
new element are added is called the rear and the end from which element are deleted is
called the front. Using this approach, the First Element Inserted is the First element to be
deleted Out, and hence, queue is also called First In First Out (FIFO) data structure.
Linked Lists: A linked list is a data structure which is a collection of zero or more nodes
where each node is connected to the next node. If each node in the list has only one link,
it is called singly linked list. If it has two links one containing the address of the next node
and other link containing the address of the previous node it is called doubly linked list.
Non-linear Data Structures: The data structures where its’ values or elements are not
stored in a sequential (linear) order is called non-linear data structures. Unlike linear data
structures, here, the logical adjacency between the elements is not maintained and hence
elements cannot be accessed if we go in sequential order. In non-linear data structures
a data item could be attached to several data items. Example: Graphs, Trees and files
IIIT-Naya Raipur.
Graphs: A graph is a non-linear data structure which is a collection of vertices called
nodes and the edges that connect these vertices. Formally, a graph G is defined as a pair
of two sets V and E denoted by G= (V, E), Where V is set of vertices and E is set of edges.
Trees: A tree is a set of finite set of one or more nodes that shows parent-child relation
such that:
Ø There is special node called the root node
Ø The remaining nodes are partitioned into disjoint subsets T1, T2, . . . , Tn , n ≥ 0
where T1, T2, T3, . . . ,Tn Which are all children of root node are themselves tree called
sub trees.
Operations on data structures: The various operations performed on various data
structures are:
Ø Creating
Ø Inserting
Ø Deleting
Ø Searching
Ø Sorting
Ø Merging
Ø Traversing
Master Theorem:
The time complexity of divide and conquer technique can be easily computed using
Master Theorem. Let the time complexity of an algorithm whose input size n is the
following recurrence relation.
𝑛
𝑇(𝑛) = 𝑎𝑇 ' ) + 𝑓(𝑛)
𝑏
Then, time complexity can be calculated using the following relation:
𝜃(𝑛! ) 𝑖𝑓 𝑎 < 𝑏 !
𝑇(𝑛) = -𝜃(𝑛! log 𝑛) 𝑖𝑓 𝑎 = 𝑏 !
𝜃(𝑛"#$! % ) 𝑖𝑓 𝑎 > 𝑏 !
IIIT-Naya Raipur.