0% found this document useful (0 votes)
53 views8 pages

Operation On Liner Data Types

The document discusses operations that can be performed on linear data structures. It describes insertion, deletion, traversal, and merging operations. Insertion involves adding an element to an array or list. Deletion removes an element. Traversal accesses each element once. Merging combines two sorted arrays or lists into a single sorted list. Examples of linear data structures mentioned are arrays and lists.

Uploaded by

Priyanshu Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views8 pages

Operation On Liner Data Types

The document discusses operations that can be performed on linear data structures. It describes insertion, deletion, traversal, and merging operations. Insertion involves adding an element to an array or list. Deletion removes an element. Traversal accesses each element once. Merging combines two sorted arrays or lists into a single sorted list. Examples of linear data structures mentioned are arrays and lists.

Uploaded by

Priyanshu Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

OPERATIONS ON

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

Step 09: Stop


1. Start

DELETION 2. Set J = K

3. Repeat steps 4 and 5


• Deletion refers to removing an existing element while J < N
from the Linear data types and re-organizing all
elements of an Linear data types. 4. Set LA[J] = LA[J + 1]
• This Operation can be performed on
list,array,linkedlist.
• This operation can only be performed on mutable 5. Set J = J+1
data types.
6. Set N = N-1
7. Stop
Step 01: Start

TRAVERSAL Step 02: [Initialize counter variable. ]


Set i = LB.

• 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

MERGING Step 2: Divide the array from the middle.

Step 3: Call merge sort for the first half of


• Merging simply means combining two or more the array
similar data type in one. MergeSort(array, first, middle)
• Mearging can be performed on the
arrays,linkedlist,list. Step 4: Call merge sort for the second half
• It can only be performed on mutable data types. of the array.
MergeSort(array, middle+1, last)

Step 5: Merge the two sorted halves into a


single sorted array.
THANK YOU!

You might also like