Deletion Of An Element From List Algorithm Explain

Algorithm For Deletion of an Element from a List explain with Example. 

Deletion of an Element from a List

Algorithm:
locate the element in the list (this involves searching)
delete the element
reorganize the list and index
Example:
        data:    345 358   490   501   513   555   561   701   724   797
        location:    0     1     2     3     4     5     6     7     8     9
Delete 358 from the above list:
Locate 358:    if we use ‘linear search’, we’ll compare 358 with each element of the list starting from the location 0.
Delete 358: remove it from the list (space=10)
        data:    345     490   501   513   555    561  701   724   797   
        location:    0     1     2     3     4     5     6     7     8     9
Reorganize the list: move the remaining elements. (space=9)
        data:    345 490   501   513   555   561   701   724   797 ?(797)
        location:    0     1     2     3     4     5     6     7     8     9


Labels: