In this post search, insert and delete operation in an unsorted array is discussed.
In an unsorted array, the search operation can be performed by linear traversal from the first element to the last element.
Element Found at Position: 5
In an unsorted array, the insert operation is faster as compared to sorted array because we don’t have to care about the position at which the element is to be placed.
Before Insertion: 12 16 20 40 50 70 After Insertion: 12 16 20 40 50 70 26
In delete operation, the element to be deleted is searched using the linear search and then delete operation is performed followed by shifting the elements.
Array before deletion 10 50 30 40 20 Array after deletion 10 50 40 20