Skip to main content
Introduction
 Values or sets of values
 A “Data Item” refers to a single set of values
 Group Items
 Elementary Items
 Collections of data are frequently organized
into a hierarchy of fields, records, and files.
 An entity is something that has certain
attributes.
 Entities with similar attributes form an entity
set.
 Each attribute of an entity set has a range of
values.
 Data with given attributes
 Meaningful or processed data
Data Processing Information
 The logical or mathematical model of a
particular organization is called data
structure.
OR
 A data structure is the arrangement of data in
a computer’s memory (or sometimes on a
disk)
It should have two qualities:
1. It should be able to create the model as close
to reality as possible.
2. It should be simple enough to process the
data efficiently when needed.
 There are two types of data:
1. Primitive: integers, real, character, Boolean.
2. Non-primitive: Linked-lists, stacks, queues,
trees & graphs
 Linear: elements form a sequence or a linear
list. Examples:Arrays, Linked Lists, Stacks,
Queues.
 Non-linear: Data is not arranged in sequence.
The insertion and deletion of data is not
possible in a linear fashion. Examples:Trees &
Graphs
 A list of a finite number “n” of similar data.
 If elements of an array are referenced as
“1,2,3, … ,n”
 The array is called “A”.
 Then the elements of “A” are denoted by
subscript notation “a₁, a₂, a₃, … an
 Or by the parenthesis notation
A(1), A(2), A(3), … , A(N)
 Or by the bracket notation
A[1], A[2], A[3], … , A[N]
 A linked list is a linear data structure where
each element is a separate object
 A linked list has two parts: one is info and the
other is link part. Info part gives information
and link part is address of next node.
 Each element has two items : the data and a
reference to next node
 The last node has reference to null
 The first node is called the head. It is not a
separate node but reference to first node.
 If the list is empty then the head is a null
reference.
 It is dynamic data structure.
 The nodes can grow and shrink on demand.
 Good for applications dealing with unknown
number of objects.
 Tree or branched data structure consists of
sets of elements (nodes) which could be
linked to other elements.
 Trees represent hierarchies, while graphs
represent more general relations such as
maps of city.
Tree Graph
 Every circle in a tree is called a node, and every
line an edge.
 Root is the node without parent
 Leaf is a node without child.
 Internal nodes are neither leaf or root.
 Path is called a sequence of nodes connecting
with edges.
 Stacks also called a last in first out system.
 Queue also called a first in first out system
 Graphs contain a relationship between pairs
of elements which is not necessarily
hierarchical in nature.
1. Traversing: Assessing each record exactly
once so that certain items in the record may
be processed. Also called visiting the record.
2. Searching: Finding the location of the record
with a given key value, or finding the
locations of all records which satisfy one or
more conditions.
3. Inserting: Adding a new record to the structure.
4. Deleting: Removing a record from the structure.
5. Sorting: Arranging the records in some logical
order.
6. Merging: Combing the records in two different
sorted files into a single sorted file.
 Data type defined in terms of operations on
it, and its implementation is hidden.
 It is easier to replace the implementation and
it will not interfere with anything in the
program.
 An ADT has 2 parts:
1. A name or type specifying a set of data
(dictionary)
2. Descriptions of all the operations (or methods)
that do things with that type (e.g., find, insert,
remove).The descriptions indicate what the
operations do, not how they do it.
 Examples: Interfaces in Java
(roughly) header files and typedef in C
 An Algorithm is a well defined list of steps for
solving a particular problem.
 The time and space it uses are two major
measures of the efficiency of an algorithm.
 The complexity of an algorithm is the
function which gives the running time and/or
space in terms of the input size.
 Refers to a choice between algorithmic
solutions of a data processing problems that
allows one to decrease the running time of an
algorithmic solution by increasing the space
to store that data and vice versa.
 Linear search searches for a specified value in
a list by checking every element in the list.
 Binary search method halves the number of
elements checked (in each iteration),
reducing the time taken to locate the given
item in the list.
Binary Search Linear Search
Works only on sorted items. such as
1,2,3,4,5,6 etc.
Works on sorted as well as unsorted
items.
12,4,5,3,2,1 etc.
Very efficient if the items are sorted Very efficient if the items are less
and present in the beginning of the
list. such as
Suppose your list items are :
12,3,4,5,1
and you want to search 12 number
then you get beginning in the list.
Works well with arrays and not on
linked lists.
Works with arrays and linked lists.
Number of comparisons are less More number of comparisons are
required if the items are present in
the later part of the array or its
elements are more.