The elements of the array are taken as input. **Then the index of the element which is to be deleted** is taken as the input also. In the case of an array, the element cannot be deleted, so the concept is to shift all the elements one index left starting from the next element of the given position.

```
INPUT: Array elements
OUTPUT: the new array after deleting the element
PROCESS:
Step 1: [taking the input]
Read n [number of elements]
For i=0 to n-1 repeat
Read a[i]
[end of ‘for’ loop]
Read pos [index of which the element has to be deleted (index starting from 0)]
Step 2: [Deleting the element]
For i=pos+1 to n-1 repeat
Set a[i-1]<-a[i]
[End of ‘for’ loop]
Step 3: [printing the array after deletion]
Print “The array after deletion: “
For i=0 to n-2 repeat
Print a[i]
[End of ‘for’ loop]
Step 4: Stop.
```

The **time complexity to take the number of elements** is **O(n)** and the **time complexity to delete the element** is also **O(n-pos)**.

Related

- Find Maximum and Minimum from an array
- Kth Largest and Smallest Element
- 2nd largest element from the array
- Find how many negative numbers are present in the array
- The elements of the one array are copied to another array.
- Frequency of each element in the Array
- Find out the unique elements from the Array
- Finds odd and even elements from the array and stored in two separate arrays
- Counts the number of odd and even elements separately from the array
- Reverses the elements of an Array
- Merge two Array and stored in the third Array
- Rotated the Array at left
- Rotated the Array right
- Sorted the array and then separate even and odd elements in different array
- Sort number of strings in an array
- Check one given element of an array present more than n/2 times or not.
- Sum of the elements of an Array is calculated using a pointer
- The union and intersection between the two given arrays