DATA STRUCTURE DETAILED NOTES FOR END TERM
DATA STRUCTURE : - A data structure defines a way of organizing all data items that
considers not only the elements stored but also their relationship to each other. The term
data structure is used to describe the way data is stored. For e.g. contact list on our
A data structure is said to be linear if its elements form a sequence or a linear
list. The linear data structures like an array, stacks, queues and linked lists organize
data in linear order. A data structure is said to be non linear if its elements form a
hierarchical classification where, data items appear at various levels e.g. trees like heap ,
b-tree, avl tree etc
Primitive Data Structures are the basic data structures that directly operate
upon the machine instructions. They have different representations on different
computers. Integers, floating point numbers, character constants, string
constants and pointers come under this category.
Array is a collection of elements
having same data type with
Linked list is an ordered collection of elements which are connected by li
In array, elements can be
accessed using index/subscript
value, i.e. elements can be
randomly accessed like arr,
arr, etc. So array provides fast
and random access.
In linked list, elements can’t be accessed randomly but can be accessed
only sequentiallyand accessing element takes 0(n) time.
In array, elements are stored
in consecutive manner in
In linked list, elements can be stored at any available place as
address of node is stored in previous node.
Insertion & Deletion
Insertion & deletion takes more
time in array as elements are
stored in consecutive memory
Insertion & deletion are fast & easy in linked list as only value
of pointer is needed to change.
In array, memory is allocated at
compile time i.e. Static
In linked list, memory is allocated at run time i.e
. Dynamic Memory Allocation.
Array can be single
dimensional, two dimension
Linked list can be singly, doubly or circular linked list.
In array, each element is
independent, no connection
with previous element or
with its location.
In Linked list, location or address of elements is stored in
the link part of previous element/node.
In array, no pointers are used
like linked list so no need of
extra space in memory for
In linked list, adjacency between the elements are maintained
using pointers or links, so pointers are used and for that
extra memory space is needed.