i suggest looking into implementation of erase() method of vector(STL). It does this for u. I wud guess they do it efficiently w/o shifting all the elements. (though my guess is it mite be moer of a systems hack than an algorithmic one). if u find anything interesting , also let us know :)
On 11/17/06, Nik <[EMAIL PROTECTED]> wrote: > > > Hi, > > I have an array in which elements are present . > The number of elements n <= 10^6 . > Now if i delete an element in the array, i want to update the > array by moving all the elements to the left. It is very slow > considering the size of element and i want to access the array > with new updated indexes (it needn't be o(1) it can be atmost O(logn)) > > ex: 4 3 2 100 > arr[2]=2; > once i access the index i delete the element, > So the new array should be 4 3 100, arr[2] should be now 100 etc. > > Can someone suggest me a good way to solve this problem > > Reg > Nik > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups-beta.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
