Understanding how to perform various operations on arrays is important to mastering the art of data manipulation. In this section, we will go through core operations performed on array data structures. Accessing and modifying individual elements in an array is already covered in the introductory article, so it is skipped in this section.
Below are all the basic operations that can be performed on an array data structure:
Traversing an Array Data Structure
One of the most common operation performed on array data structure is to traverse or visit all elements present inside it. This operation is also known as iterating an array. In this operation, we start from index 0, access the value, then move on to index 1, access the value, and so on until the last index.
Read More
Inserting an element into Array Data Structure
While working with arrays, for efficiency purposes, we allocate more space for an array than the required amount during initialization, leaving room for future expansion. Later on when there is a necessity, more elements are inserted into the array.
Read More
Deleting an element in Array Data Structure
In this article we will go through different scenarios for deleting an element at a given index in an array data structure. For all the scenarios explained below, we take example of an array which has enough memory to store a maximum of 7 elements.
Read More