InterviewSolution
Saved Bookmarks
| 1. |
In array A[n], after deletion of ay element, no element was shifted, thus, the free space is scattered across the array. You have been given the task to solve this problem. Write an algorithm to combine all the elements at the rear end of the array so that all the free spaces are available at the beginning of the array. |
|
Answer» 1. ctr=pos 2. Repeat steps 3 and 4 until ctr<=1 3. A[ctr]=A[ctr-1] 4. ctr=ctr-1 /* End of Repeat*/ 5. Display the new list of element 6. End |
|