Professional Documents
Culture Documents
Operation On Liner Data Types
Operation On Liner Data Types
LINER DATA
Presented by Priyanshu Kumar
STRUCTURES
•University Roll No
•Department
•Paper Name
32401221049
BCA
Object Oriented Programming
•Paper Code BCAC301
LINER DATA STRUCTURE
A Linear data structure have data elements arranged in
sequential manner and each member element is
connected to its previous and next element. Some
examples of Liner data structures
• Arrays
• list
OPERATIONS WE
PERFORM ON LINER DATA
STRUCTURE
Insertion
1
Deletion
2
Traversal
3
Merging
4
Step 01: Start
INSERTION
Step 02: [Reset size of the array. ] set size
= size + 1
Step 03: [Initialize counter variable. ] Set i
= size - 1
• Insert operation is to insert one or more data Step 04: Repeat Step 05 and 06 for i = size
elements into a linear data -1 to i >= pos -1
structure(Array,List,etc). Based on the Step 05: [Move ith element forward. ] set
requirement, a new element can be added at the arr[i+1] = arr[i]
beginning, end, or any given index of linear data Step 06: [Decrease counter. ] Set i = i - 1
structure(Array,List,etc).
• We can perform Insertion on Array, list, liked Step 07: [End of step 04 loop. ]
list,etc. Step 08: [Insert element. ] Set arr[pos-1] =
x
DELETION 2. Set J = K
• Traversal operation in array or simply traversing Step 03: Repeat for i = LB to UB.
an array means, Accessing or printing each element
of an array exactly once so that the data items
Step 04: Apply process to arr[i].
(values) of the array can be checked or used as part
of some other operation or process (This accessing
and processing is sometimes called “visiting” the Step 05: [End of loop. ]
array).
. Step 06: Stop
Step 1: Find the middle index of the array.
Middle = 1 + (last – first)/2