SlideShare a Scribd company logo
1 of 11
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

What's hot (20)

Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
Linked List
Linked ListLinked List
Linked List
 
Singly link list
Singly link listSingly link list
Singly link list
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
single linked list
single linked listsingle linked list
single linked list
 
Linked lists
Linked listsLinked lists
Linked lists
 
Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Singly & Circular Linked list
Singly & Circular Linked listSingly & Circular Linked list
Singly & Circular Linked list
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
 
Ppt bubble sort
Ppt bubble sortPpt bubble sort
Ppt bubble sort
 
stack presentation
stack presentationstack presentation
stack presentation
 
Array data structure
Array data structureArray data structure
Array data structure
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 

Viewers also liked

القوائم المترابطة Linked List باستخدام لغة جافا
القوائم المترابطة Linked List باستخدام لغة جافاالقوائم المترابطة Linked List باستخدام لغة جافا
القوائم المترابطة Linked List باستخدام لغة جافاMahmoud Alfarra
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureSriram Raj
 
المحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابورالمحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابورMahmoud Alfarra
 
1 intro of data structure course
1  intro of data structure course1  intro of data structure course
1 intro of data structure courseMahmoud Alfarra
 
2 introduction to data structure
2  introduction to data structure2  introduction to data structure
2 introduction to data structureMahmoud Alfarra
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in CSmit Parikh
 
Data structure and algorithm with java implementation by obaid kakar
Data structure and algorithm with java implementation by obaid kakarData structure and algorithm with java implementation by obaid kakar
Data structure and algorithm with java implementation by obaid kakarObaid Kakar
 

Viewers also liked (8)

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

Similar to Array operations

Similar to Array operations (20)

A sorted linear array
A sorted linear array A sorted linear array
A sorted linear array
 
Sorting techniques
Sorting techniquesSorting techniques
Sorting techniques
 
Insertion and Redix Sort
Insertion and Redix SortInsertion and Redix Sort
Insertion and Redix Sort
 
DSA Unit II array.pptx
DSA Unit II array.pptxDSA Unit II array.pptx
DSA Unit II array.pptx
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sorting
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Array Presentation
Array PresentationArray Presentation
Array Presentation
 
Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
 
Arrays
ArraysArrays
Arrays
 
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCEDATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
 
arrays
arraysarrays
arrays
 
List - Operations and Implementation
List - Operations and ImplementationList - Operations and Implementation
List - Operations and Implementation
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
 

Recently uploaded

Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 

Recently uploaded (20)

Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 

Array operations

  • 1.
  • 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 .