Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array.
Element − Each item stored in an array is called an element.
Index − Each location of an element in an array has a numerical index, which is used to identify the element.
Array Representation
int array[10];
Following are the important points to be considered.
Index starts with 0.
Array length is 10 which means it can store 10 elements.
Each element can be accessed via its index. For example, we can fetch an element at index 6 or index 9.
Basic Operations
Following are the basic operations supported by an array.
Traverse − print all the array elements one by one.
Insertion − Adds an element at the given index.
Deletion − Deletes an element at the given index.
Search − Searches an element using the given index or by the value.
Update − Updates an element at the given index.
Address of an element of an array say “A[ k ]” is calculated using the following formula:
Address of A [ k ] = B + W * ( k – LB )
Where,
B = Base address
W = Storage Size of one element stored in the array (in byte)
k = Subscript of element whose address is to be found
On this page of the site you can watch the video online Insertion in Linear Arrays | Data Structure & Algorithm with a duration of hours minute second in good quality, which was uploaded by the user Sujeet Kumar Jha 10 September 2020, share the link with friends and acquaintances, this video has already been watched 104 times on youtube and it was liked by 5 viewers. Enjoy your viewing!