SlideShare a Scribd company logo
5
Most read
8
Most read
9
Most read
Array operations
It Is An Ordered List, Which Consist Of 
A Fixed Number Of Homogeneous Data 
Items (Elements).An Array Is A Primitive 
Data Structure. These Elements Are 
Stored In Successive Memory Locations 
According To Size Of Data Type. Array Is 
Also Referred As Set Of (Index , Value).
(index) 
A[0] A[1] A[2] A[3] A[4] A[5] A[MAX -1] 
10 5 46 2 100 97 ... 
Data element value
The Insert Operation Is Performed By 
Shifting All The Elements One Position 
Ahead From Index iTo N-1 Where i Is The 
Specified Index For New Element Is To Be 
Inserted. And Adding The New Element To 
The Array At The Specified Index Position.
For example, 
index for insertion is i=2 and new element is 17 with N=6. the 
MAX is the size of the array A. 
A[0] A[1] A[2] … A[N-1] A[MAX-1] 
10 5 46 2 100 97 … 
Insert index position 
Move All Elements From Insert Index Position I N-1 Towards Right By One Position 
A[0] 1 2 3 4 5 A[6] A[MAX-1] 
10 5 46 2 100 97 … 
Insert Index Position
A[0] 1 2 3 4 5 A[6] A[MAX-1] 
10 5 46 46 2 100 97 … 
Insert index position 
Shifted elements
Now, insert (store) new data element 17 at given index position 2: 
A[0] 1 2 3 4 5 A[6] A[MAX-1] 
10 5 17 46 2 100 97 … 
Inserted element 
For Every New Element Inserted The Number Of Elements 
I.E N Should Be Incremented By 1. If N= Max-1 Then Array 
Is Full And Insertion Operation Cannot Be Performed As 
There Is No Space For New Element In The Array.
The delete operation will delete the element at 
specified element index from one-dimensional array. 
The deletion operation performed by shifting all the 
elements one position before from index i=1 to N-1 
where i is the index of element to be deleted. A[i] = 
A[i+1], for all i to N-1 . This shifting causes 
overwriting of the said element with element at next 
index position.
For example, 
For an array N=7 and index position for deletion is 
i=3 and maximum array size as MAX. 
A[0] 1 2 3 4 5 A[6] A[MAX-1] 
10 5 17 46 2 100 97 … 
Delete Index Position 
Now , Shift All Element From Index 4 To 6 One Position Before As Below: 
A[0] 1 2 3 4 5 A[6] A[MAX-1] 
10 5 17 46 2 100 97 … 
Element At Index 3 
The Array After The Shifting Backward Is:
A[0] 1 2 3 4 A[5] A[MAX-1] 
10 5 17 2 100 97 97 … 
Last element of array 
The element 46 is deleted from the array. After every 
delete operation the number of elements N should be 
decrement by 1. if array is empty , the deletion operation 
cannot be performed .
Array operations

More Related Content

PPTX
Data structures
PPTX
Array in c language
PDF
Array data structure
PPTX
sorting and searching.pptx
PPT
3.9 external sorting
PPTX
2D Array
PPTX
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
PDF
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
Data structures
Array in c language
Array data structure
sorting and searching.pptx
3.9 external sorting
2D Array
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI

What's hot (20)

PPTX
Arrays in Data Structure and Algorithm
PPT
BINARY TREE REPRESENTATION.ppt
PPTX
Stacks IN DATA STRUCTURES
PPTX
Queue Implementation Using Array & Linked List
PPTX
Stack and Queue
PPT
PPTX
Binary search
PPTX
Stack and its operations
PPTX
Quick sort
PPTX
Arrays In C++
PPT
Arrays in c
PPT
PPTX
Priority Queue in Data Structure
PPT
Data Structure and Algorithms Arrays
PDF
Arrays in python
PPTX
Infix to postfix conversion
PPTX
queue & its applications
PPTX
Introduction to Array ppt
PPTX
Binary Tree Traversal
PPTX
Binary Heap Tree, Data Structure
Arrays in Data Structure and Algorithm
BINARY TREE REPRESENTATION.ppt
Stacks IN DATA STRUCTURES
Queue Implementation Using Array & Linked List
Stack and Queue
Binary search
Stack and its operations
Quick sort
Arrays In C++
Arrays in c
Priority Queue in Data Structure
Data Structure and Algorithms Arrays
Arrays in python
Infix to postfix conversion
queue & its applications
Introduction to Array ppt
Binary Tree Traversal
Binary Heap Tree, Data Structure
Ad

Viewers also liked (8)

PPTX
القوائم المترابطة Linked List باستخدام لغة جافا
PPT
Queue Data Structure
PPTX
المحاضرة الثامنة: تراكيب البيانات الطابور
PDF
3 Array operations
PDF
1 intro of data structure course
PPTX
2 introduction to data structure
PPT
Multidimensional array in C
PDF
Data structure and algorithm with java implementation by obaid kakar
القوائم المترابطة Linked List باستخدام لغة جافا
Queue Data Structure
المحاضرة الثامنة: تراكيب البيانات الطابور
3 Array operations
1 intro of data structure course
2 introduction to data structure
Multidimensional array in C
Data structure and algorithm with java implementation by obaid kakar
Ad

Similar to Array operations (20)

PPTX
array-140928101958-pyyyyyyyyyyyhpapp02.pptx
PPTX
DS Module1 (1).pptx
PPTX
arrays in data structure.pptx
PPTX
Data structures (Array 1 dimensional).pptx
PPTX
Data Structures - Array presentation .pptx
PPTX
DOCX
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
PPTX
2.DS Array
PPTX
Arrays.pptx
PDF
DSA UNIT II ARRAY AND LIST - notes
PDF
PPT
PPTX
Lecture 3 data structures and algorithms
PPTX
array lecture engineeringinformatin_technology.pptx
PDF
Array data structure
PPTX
datastructure concepts ppt-190327174340.pptx
PPTX
Array Operations.pptxdata structure array indsa
PPTX
Data structure and algorithm All in One
PPTX
Data structure using c module 1
PPTX
The document discusses arrays in data structures using Cpp programming langua...
array-140928101958-pyyyyyyyyyyyhpapp02.pptx
DS Module1 (1).pptx
arrays in data structure.pptx
Data structures (Array 1 dimensional).pptx
Data Structures - Array presentation .pptx
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
2.DS Array
Arrays.pptx
DSA UNIT II ARRAY AND LIST - notes
Lecture 3 data structures and algorithms
array lecture engineeringinformatin_technology.pptx
Array data structure
datastructure concepts ppt-190327174340.pptx
Array Operations.pptxdata structure array indsa
Data structure and algorithm All in One
Data structure using c module 1
The document discusses arrays in data structures using Cpp programming langua...

Recently uploaded (20)

PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
PPT on Performance Review to get promotions
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
OOP with Java - Java Introduction (Basics)
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPT on Performance Review to get promotions
Lecture Notes Electrical Wiring System Components
OOP with Java - Java Introduction (Basics)
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Operating System & Kernel Study Guide-1 - converted.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Foundation to blockchain - A guide to Blockchain Tech
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CYBER-CRIMES AND SECURITY A guide to understanding
Model Code of Practice - Construction Work - 21102022 .pdf
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Mechanical Engineering MATERIALS Selection
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
bas. eng. economics group 4 presentation 1.pptx
Construction Project Organization Group 2.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...

Array operations

  • 2. It Is An Ordered List, Which Consist Of A Fixed Number Of Homogeneous Data Items (Elements).An Array Is A Primitive Data Structure. These Elements Are Stored In Successive Memory Locations According To Size Of Data Type. Array Is Also Referred As Set Of (Index , Value).
  • 3. (index) A[0] A[1] A[2] A[3] A[4] A[5] A[MAX -1] 10 5 46 2 100 97 ... Data element value
  • 4. The Insert Operation Is Performed By Shifting All The Elements One Position Ahead From Index iTo N-1 Where i Is The Specified Index For New Element Is To Be Inserted. And Adding The New Element To The Array At The Specified Index Position.
  • 5. For example, index for insertion is i=2 and new element is 17 with N=6. the MAX is the size of the array A. A[0] A[1] A[2] … A[N-1] A[MAX-1] 10 5 46 2 100 97 … Insert index position Move All Elements From Insert Index Position I N-1 Towards Right By One Position A[0] 1 2 3 4 5 A[6] A[MAX-1] 10 5 46 2 100 97 … Insert Index Position
  • 6. A[0] 1 2 3 4 5 A[6] A[MAX-1] 10 5 46 46 2 100 97 … Insert index position Shifted elements
  • 7. Now, insert (store) new data element 17 at given index position 2: A[0] 1 2 3 4 5 A[6] A[MAX-1] 10 5 17 46 2 100 97 … Inserted element For Every New Element Inserted The Number Of Elements I.E N Should Be Incremented By 1. If N= Max-1 Then Array Is Full And Insertion Operation Cannot Be Performed As There Is No Space For New Element In The Array.
  • 8. The delete operation will delete the element at specified element index from one-dimensional array. The deletion operation performed by shifting all the elements one position before from index i=1 to N-1 where i is the index of element to be deleted. A[i] = A[i+1], for all i to N-1 . This shifting causes overwriting of the said element with element at next index position.
  • 9. For example, For an array N=7 and index position for deletion is i=3 and maximum array size as MAX. A[0] 1 2 3 4 5 A[6] A[MAX-1] 10 5 17 46 2 100 97 … Delete Index Position Now , Shift All Element From Index 4 To 6 One Position Before As Below: A[0] 1 2 3 4 5 A[6] A[MAX-1] 10 5 17 46 2 100 97 … Element At Index 3 The Array After The Shifting Backward Is:
  • 10. A[0] 1 2 3 4 A[5] A[MAX-1] 10 5 17 2 100 97 97 … Last element of array The element 46 is deleted from the array. After every delete operation the number of elements N should be decrement by 1. if array is empty , the deletion operation cannot be performed .