Thursday, 18 July 2013

Algorithm for Insertion in One–Dimensional Array

  1. [Initialize the value of i] Set i=len
  2. Repeat for i=len down to pos[Shift the elements down by one position]Set a[i+1]=a[i][End of loop]
  3. [insert the elements at required position]Set a[pos]=num
  4. [Reset len] Set len= len+1
  5. Display the new list of arrays
  6. End

No comments:

Post a Comment