Handout 2
Handout 2
“the logical or mathematical representation of the given data in computer memory is known
as data structure”.
The data structures are primarily of two types: Linear data structures and Non- linear data
structures.
Linear data structures: A linear data structure is one in which the elements are arranged
in a linear sequence. In linear data structure, for each and every element there is exactly
one preceding element and only one succeeding element(except the first and last).
Ex: Stacks, Queues, Linked Lists and Arrays.
Non-Linear data structure: A non- linear data structure represents the non-
linear/hierarchical relationship between the elements.
Ex: Trees, Graphs
Operations performed on data structures:
The most common operations performed on data structure are: Insertion, Deletion,
Traversing, searching, sorting and merging.
Insertion: The process of adding a new element into the existing data structure.
Deletion: The process of removing an element from the data structure.
Traversal: The process of visiting each and every element of the data structure.
Searching: The process of verifying whether a particular element exist in the data
structure or not.
Sorting: The process of rearranging all the elements of the data structure either in
ascending or in descending order.
Merging: The process of combining two or more similar data structures into one.
Array Vs Linked List: Size, Accessing of elements, insertion and deletion operations
Linked List: Set of nodes in which every node is linked with its next node.
Three types of linked lists are: Singly linked list, doubly linked list, circular linked list
Singly linked list : Every node consists two parts: data and link to the next node
Singly linked list supports only one way traversal ( in forward direction)
Doubly linked list: Every node consists three parts: data, link to previous node and link to
next node.
DLL supports two way traversal ( both forward and backward)
Circular Linked List: two ways of representing Circular SLL and Circular DLL . Last node
and first linked with each other.