Deleting an element from one-dimensional array
For deleting an element from the array, the logic is straight forward. Deleting an element at the end of an array presents no difficulties, but deleting element somewhere in the middle of array would require to shift all the elements to fill the space emptied by the deletion of the element a[5]=90 then the elements following it were moved upward one location as shown in figure 3.2
Fig.3.2 deleting an element from one-dimensional array.
Algorithm for deletion of an element from the array.
The following algorithm deletes the element stored at position pos from a linear array a and assign it to a variable item.
Delete (a, pos, n)
Where n be the length of linear array.
Traversing of array
Traversing means to access all the elements of the array. Starting from first element up to the (upper bond) last element in the array one-by-one.
Data Structure & Algorithms Assignment Help, Live Experts
Struggling with data structure problems? Data structure subject is quite tough to learn? Need quick assistance in data structure questions? ExpertsMind.com is right place for you where your search ends, We at ExpertsMind offer online data structure assignment help, data structure homework help and data structure and algorithms question's answers by best online support by qualified tutors.